[opensuse] cron and every second saturday
Howdy list.. So I've been trying to work on getting cron to work with every second saturday (or any second day of the week for that matter), and I just cannot get it.. Here are some things i've tried: The next is running every 5 minutes and checks for Tue (since today is Tuesday and I am testing). This should work as it is the 12th day of the month. */5 * 8-14 8 * test `date +%a` = "Tue" && echo `date` >> ~/date That didn't work for me.. so I said .. forget it and tried: */5 * * 8 2 if [ `date +%d` -ge 8 -a `date +%d` -le 14 ]; then echo `date` >> ~/date; fi still nothing. the commands work just fine which points me back to the cron schedule. BTW .. this is running under the root cron. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Ben Kevan pecked at the keyboard and wrote:
Howdy list..
So I've been trying to work on getting cron to work with every second saturday (or any second day of the week for that matter), and I just cannot get it.. Here are some things i've tried:
The next is running every 5 minutes and checks for Tue (since today is Tuesday and I am testing). This should work as it is the 12th day of the month.
*/5 * 8-14 8 * test `date +%a` = "Tue" && echo `date` >> ~/date
That didn't work for me.. so I said .. forget it and tried:
*/5 * * 8 2 if [ `date +%d` -ge 8 -a `date +%d` -le 14 ]; then echo `date` >> ~/date; fi
still nothing. the commands work just fine which points me back to the cron schedule. BTW .. this is running under the root cron.
Unless you run these from a script and provide an environment you will need to supply the full path for the commands, I.E. /bin/date in order for it to work. -- Ken Schneider SuSe since Version 5.2, June 1998 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tuesday 12 August 2008 03:26:32 pm Ken Schneider wrote:
Unless you run these from a script and provide an environment you will need to supply the full path for the commands, I.E. /bin/date in order for it to work.
-- Ken Schneider SuSe since Version 5.2, June 1998
Hi Ken, the paths are defined, but just for the sake of sakeness.. the following still does not work: */5 * 10-14 8 * /usr/bin/test `/bin/date +%a` = "Tue" && /bin/echo `/bin/date`
/home/bkevan/date
I will also try: */5 * * 8 2 if [ `/bin/date +%d` -ge 8 -a `/bin/date +%d` -le 14 ]; then /bin/echo `/bin/date` >> /home/bkevan/date; fi -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hello, Ben Kevan wrote:
the paths are defined, but just for the sake of sakeness.. the following still does not work:
*/5 * 10-14 8 * /usr/bin/test `/bin/date +%a` = "Tue" && /bin/echo `/bin/date`
/home/bkevan/date
I will also try:
*/5 * * 8 2 if [ `/bin/date +%d` -ge 8 -a `/bin/date +%d` -le 14 ]; then /bin/echo `/bin/date` >> /home/bkevan/date; fi
Whatever you try to achieve - you try a hard approach. Simply put your stuff into a shell script and let cron run that script. Like e.g. you created /home/user/bin/myscript.sh then you let the cron be: 5 12 * * * /home/user/bin/myscript.sh Greetings, Marco -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tuesday 12 August 2008 05:45:57 pm Marco Michna wrote:
Hello,
Ben Kevan wrote:
the paths are defined, but just for the sake of sakeness.. the following still does not work:
*/5 * 10-14 8 * /usr/bin/test `/bin/date +%a` = "Tue" && /bin/echo `/bin/date`
/home/bkevan/date
I will also try:
*/5 * * 8 2 if [ `/bin/date +%d` -ge 8 -a `/bin/date +%d` -le 14 ]; then /bin/echo `/bin/date` >> /home/bkevan/date; fi
Whatever you try to achieve - you try a hard approach. Simply put your stuff into a shell script and let cron run that script. Like e.g. you created /home/user/bin/myscript.sh then you let the cron be:
5 12 * * * /home/user/bin/myscript.sh
Greetings, Marco
I'll try to put it in a script and try it that way.. But shouldn't it work just fine without it being in a script? The call of the script will still be the same. I'll let you know monday how that goes (4 day weekend .. and awayyyyyyyyyyyyyyy) Ben -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hello, Ben Kevan wrote:
I'll try to put it in a script and try it that way.. But shouldn't it work just fine without it being in a script? The call of the script will still be the same.
I'll let you know monday how that goes (4 day weekend .. and awayyyyyyyyyyyyyyy)
Just as a hint: man 5 crontab The ``sixth'' field (the rest of the line) specifies the command to be run. The entire command portion of the line, up to a newline or % character, will be executed by /bin/sh or by the shell specified in the SHELL variable of the cronfile. Percent-signs (%) in the command, unless escaped with backslash (\), will be changed into newline charac‐ ters, and all data after the first % will be sent to the command as standard input. Greetings, Marco -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (3)
-
Ben Kevan
-
Ken Schneider
-
Marco Michna