Confused with cron
Hi all,
I have a cron job like this. 04 07 17 04 02 sh -x myscript this means the file myscript should be executed when the server date comes to Apr 17 on Tuesday at 07 04 am. But the file myscript runs on every tuesday of April month. Whats wrong with cron i am very confused. Your suggestions please. Thanks®ards, Dinesh. |
Hi,
Try reading the man page for the cron file format man 5 crontab The format is: minute 0-59 hour 0-23 day of month 1-31 month 1-12 (or names, see below) day of week 0-7 (0 or 7 is Sun, or use names) Best regards, |
hi,
Thanks i did that, But no improvement in my problem. |
FYI
Quote:
|
Hi michaelk,
Thanks for your reply. ``30 4 1,15 * 5'' from your example. The command should run only when the date 1st and 15th of the month comes on friday. Is that possible. |
FYI that was a quote from the man pages...
If you want to run a job on a particular day / day of the week then you need something like the following. 04 07 1,15 * * [ "$(date '+\%a')" == "Fri" ] && /path/to/your/job.sh |
Thanks michaelk,
it works I used 04 07 1,15 04 * [ "$(date '+\%w')" == "5" ] && /path/to/your/job.sh This in cron to execute my job only on 1st and 15th date of April and that too only when it falls on friday. |
All times are GMT -5. The time now is 11:23 AM. |