Here is a listing of each:
The commands run a backup of different filesystems.
Onyx2
min hour daymo month daywk cmd
0 20 15-21 * 2 backup_root
0 20 15-21 * 4 backup_home
Onyx
min hour daymo month daywk cmd
0 20 8-14 * 2 backup_root
Indigo
min hour daymo month daywk cmd
0 20 1-7 * 2 backup_root
The problem is that, on Onyx2, both jobs ran
simultaneously on Tuesday of this week, even though the
daywk for the backup_home was 4.
On Onyx and Indigo, both jobs ran on Tuesday of this
week when the daymo were for the first and second weeks
weeks of the month.
Any help would be appreciated.
Dane
This specifies that backup_root should be executed every day in the
week from 15-21th, and, additionally, on every tuesday.
You probably meant to specify the third tuesday of the month. Cron
doesn't work that way.
The easiest way out would probably be to change the cron-job to
0 20 15-21 * * backup_root
and change backup_root to only do a backup on tuesday, and exit
otherwise.
If you are really into unix wizardry, you might also try something
like the following set of cron jobs to achieve the same results:
59 19 * * 2 touch /tmp/tuesday
0 20 15-21 * * [ -f /tmp/tuesday ] && backup_root
1 20 * * 2 rm -f /tmp/tuesday
Note that this is off the top of my head, untested etc. Use at your
own risk.
Groetjes,
Kees-Jan
Groetjes,
Kees-Jan
In article <785n4a$6r6$1...@server.cntfl.com>, DaneMan <dan...@bsc.net> wrote:
>I've got a question about a cron job that I'm running.
>There are three different crons running on three SGI
>machines (Onyx2, Onyx, Indigo)
>
>Here is a listing of each:
>The commands run a backup of different filesystems.
>
>Onyx2
>min hour daymo month daywk cmd
>0 20 15-21 * 2 backup_root
>0 20 15-21 * 4 backup_home
>
>Onyx
>min hour daymo month daywk cmd
>0 20 8-14 * 2 backup_root
>
>Indigo
>min hour daymo month daywk cmd
>0 20 1-7 * 2 backup_root
>
>The problem is that, on Onyx2, both jobs ran
>simultaneously on Tuesday of this week, even though the
>daywk for the backup_home was 4.
>
>On Onyx and Indigo, both jobs ran on Tuesday of this
>week when the daymo were for the first and second weeks
>weeks of the month.
When you specify both a day of month and day of week, it runs the cron job
when either criteria is met, not only when both criteria are met. So
backup_root on Onyx2 will run every Tuesday and also every day from 15-21
of the month.
To do what you want, I suggest you change your backup scripts to take
parameters specifying the range of days of the month they should run. So
Onyx2's cron would look like:
min hour daymo month daywk cmd
0 20 * * 2 backup_root 15 21
0 20 * * 4 backup_home 15 21
The script would use date(1) to get the current day of the month, and then
check whether it's in the range specified by the parameters.
--
Barry Margolin, bar...@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Don't bother cc'ing followups to me.
}The easiest way out would probably be to change the cron-job to
}0 20 15-21 * * backup_root
}and change backup_root to only do a backup on tuesday, and exit
}otherwise.
}If you are really into unix wizardry, you might also try something
}like the following set of cron jobs to achieve the same results:
}59 19 * * 2 touch /tmp/tuesday
}0 20 15-21 * * [ -f /tmp/tuesday ] && backup_root
}1 20 * * 2 rm -f /tmp/tuesday
Why not just:
0 20 15-21 * * test "$(date +\%w)" = 2 && backup_root
--
Geoff Clare <g...@root.co.uk>
UniSoft Limited, London, England.