Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
11-18-2016, 07:17 AM
|
#1
|
Member
Registered: Mar 2011
Posts: 32
Rep:
|
Cronjob for biweekly
Hello Team,
I need cronjob syntax to schedule job for every 2 week(biweekly).
for example, suppose i executed job today(18 Nov) then next job should execute on 2 Dec on 10 AM.
I tried with below syntax but does not work out.
note: running on ubuntu system.
* 10 * * 5/2
* 10 7-14,21-28 * 5
Please help me here.
Last edited by ghpradeep; 11-18-2016 at 07:19 AM.
|
|
|
11-18-2016, 07:28 AM
|
#2
|
LQ Guru
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,330
|
i think you will need to cron it weekly and handle the bi-weekly logic in the program being run.
i would have it touch a file when it ends and create an if statement to check for the existence of said file and if it does exist then delete it and end; else continue.
|
|
|
11-18-2016, 07:35 AM
|
#3
|
Senior Member
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,039
Rep:
|
I dont have a Linux session to hand at present but I would expect the 1st example to be invalid
Both are requesting to run every minute between 10:00 and 10:59 which I don't think is what you want
Fields are:
Minutes
Hours
Dayofmonth
Months
Dayofweek
Suggesting your 2nd option is closer to what you are asking for
|
|
|
11-18-2016, 07:56 AM
|
#4
|
LQ Guru
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342
|
|
|
1 members found this post helpful.
|
11-18-2016, 12:35 PM
|
#5
|
Member
Registered: Nov 2015
Distribution: Debian Sid
Posts: 119
Rep:
|
It would be overkill if this is all you need to do. But if you find yourself doing this sort of thing a lot, and it's appropriate for your environment, you might be interested in remind. It has an entire language built for scheduling things, and you can view reminders as a calendar using wyrd. It can also execute arbitrary scripts instead of reminding you of things, though I'm not sure I'd give it root privileges. Here's an example from the man page:
For example, suppose you get paid every second Wednesday, and your last payday was Wednesday,28 October, 1992. You can use:
REM 28 Oct 1992 *14 MSG Payday
Also, anacron and (I would assume) systemd timers could be used for this.
Last edited by crazy-yiuf; 11-18-2016 at 12:44 PM.
|
|
|
All times are GMT -5. The time now is 06:38 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|