Results 1 to 8 of 8
Hello
I need to create the following cron jobs:
job #1: runs Mon,Tue,Wed,Thu,Fri,Sun at 9PM every month except for 15th
job#2: runs on 15th of each month at 9PM
job ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 05-25-2010 #1Just Joined!
- Join Date
- May 2010
- Posts
- 4
CRON jobs
Hello
I need to create the following cron jobs:
job #1: runs Mon,Tue,Wed,Thu,Fri,Sun at 9PM every month except for 15th
job#2: runs on 15th of each month at 9PM
job #3: runs every Saturday at 6PM every month
What is the correct syntax for this kind of scheduled cron jobs?
Thanks,
Lena
- 05-25-2010 #2
If you go into a terminal and run the command "man 5 crontab", you will get a page of documentation explaining crontab. This includes information on the format of the crontab file.
Alternatively, you can go to Wikipedia and see the information there:
http://en.wikipedia.org/wiki/Cron
- 05-25-2010 #3Just Joined!
- Join Date
- May 2010
- Posts
- 4
I know how to use documentation.
I'm asking for help to post exact syntax for this scenario.
The one I already have doesn't work.
- 05-25-2010 #4forum.guy
- Join Date
- May 2004
- Location
- arch linux
- Posts
- 18,733
- 05-25-2010 #5Just Joined!
- Join Date
- May 2010
- Posts
- 4
# normal backups w/ cleanup
10 21 1-14,16-31 * 0,1,2,3,4,5 /export/home/oracle/scripts/rmanscriptinc1 > /export/home/oracle/logs/cronrmaninc1.out 2>&1
10 18 * * 6 /export/home/oracle/scripts/rmanscriptinc0 > /export/home/oracle/logs/cronrmaninc0.out 2>&1
# backup entries with cleanup
#10 18 * * 6 /export/home/oracle/scripts/rmanscriptinc0 > /export/home/oracle/logs/cronrmaninc0.out 2>&1
10 21 15 * 0,1,2,3,4,5 /export/home/oracle/scripts/rmanscriptinc1_cleanup > /export/home/oracle/logs/cronrmaninc1.out 2>&1
What happened yesterday is that both scripts rmanscriptinc1 and rmanscriptinc1_cleanup ran even though rmanscriptinc1_cleanup is only scheduled to run once a month on 15th.
Thanks,
Lena
- 05-26-2010 #6Linux Guru
- Join Date
- Nov 2007
- Posts
- 1,722
Google: cron examples
Code:5,10 0 10 * 1 – At 12.05,12.10 every Monday & on 10th of every month
- 05-26-2010 #7Just Joined!
- Join Date
- May 2010
- Posts
- 4
I don't think it will work in my case.
In your example you have the same job scheduled, and in my case I need to schedule 2 separate jobs.
- 05-26-2010 #8Linux Guru
- Join Date
- Nov 2007
- Posts
- 1,722
Q.
A.What happened yesterday is that both scripts rmanscriptinc1 and rmanscriptinc1_cleanup ran even though rmanscriptinc1_cleanup is only scheduled to run once a month on 15th.
NO, it's not.
Code:5,10 0 10 * 1 – At 12.05,12.10 every Monday & on 10th of every month
Let's read the example AGAIN.
This is scheduled for dates 1-14, 16-31 AND Sun > Fri - like it says in any CRON example/link/documentation.Code:10 21 1-14,16-31 * 0,1,2,3,4,5 /export/home/oracle/scripts/rmanscriptinc1 > /export/home/oracle/logs/cronrmaninc1.out 2>&1


Reply With Quote

