Results 1 to 6 of 6
I am having a bit of trouble and thought I come here to make sure I am correct.
I want to run a command at 1:59 on Sunday once a ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 01-24-2013 #1Linux Newbie
- Join Date
- Jun 2006
- Posts
- 141
crontab help
I am having a bit of trouble and thought I come here to make sure I am correct.
I want to run a command at 1:59 on Sunday once a month every month. Here is my crontab entry:
59 1 * 1-12 0
Is it correct?
Thanks in advance
mace
- 01-25-2013 #2Just Joined!
- Join Date
- Feb 2012
- Posts
- 7
There is a similar example in man 5 crontab
- 01-25-2013 #3Just Joined!
- Join Date
- Jul 2008
- Posts
- 49
Sorry, but what you have will execute every Sunday. What you want might be:
59 1 * * 0 [ $(date +\%d) -lt 8] && /your/script
The date +%d gives you number of current day. The script only executes if today's day is < 8, which means you get what you asked for above. An alternative is to include similar code at the top of your script, which terminates execution is today if not the 1st through the 7th.
- 01-25-2013 #4Linux Newbie
- Join Date
- Jun 2006
- Posts
- 141
Toad...thanks for the reply. The more I looked at it the more I knew i was wrong.
Also thanks for the code
mace
- 01-26-2013 #5Just Joined!
- Join Date
- Jan 2013
- Posts
- 2
There is a cron simulator where you can try out these examples and any other set of timing parameters at the CronBuddy website.
- 04-04-2013 #6Just Joined!
- Join Date
- Jan 2013
- Posts
- 2


1Likes
Reply With Quote

