We have CENTOS 5 on DELL server. I tried to setup schedule cron job to run every other week on Saturday (NOT first and third week ). Does ayone has ideal how to do it? Thanks. ___________________________________________________ ??????? ? ???????????????? http://messenger.yahoo.com.tw/
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 06/01/2010 00:47, mcclnx mcc wrote:> We have CENTOS 5 on DELL server. I tried to setup schedule cron job to run every other week on Saturday (NOT first and third week ). > > Does ayone has ideal how to do it?Maybe like that... 1 1 * * 6/2 /bla/bin/doit would read: do /bla/bin/doit at 1:01 every second saturday. Unverified, but see #$ man 5 crontab - -- best regards, markus -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAktD0+cACgkQYoWFBIJE9eX4yQCfWTgAnKoswARcqmnbFSWdhLYi xnwAn033u9HzlD5+uXfxHK+8w47ZF5mM =lHBG -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 06/01/2010 00:47, mcclnx mcc wrote:> We have CENTOS 5 on DELL server. I tried to setup schedule cron job to run every other week on Saturday (NOT first and third week ). > > Does ayone has ideal how to do it?Maybe like that... 1 1 * * 6/2 /bla/bin/doit would read: do /bla/bin/doit at 1:01 every second saturday. Unverified, but see #$ man 5 crontab - -- best regards, markus -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAktD1CIACgkQYoWFBIJE9eUP+ACfdrYY/M/kg0P3WMhvJqD6fhnr V8oAn0qjpppXPyapu6HU4UxIntQu6BYD =XLyR -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 06/01/2010 00:47, mcclnx mcc wrote:> We have CENTOS 5 on DELL server. I tried to setup schedule cron job to run every other week on Saturday (NOT first and third week ). > > Does ayone has ideal how to do it?Maybe like that... 1 1 * * 6/2 /bla/bin/doit would read: do /bla/bin/doit at 1:01 every second saturday. Unverified, but see #$ man 5 crontab - -- best regards, markus -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAktD1i4ACgkQYoWFBIJE9eWPhQCdH2hsOBQD4BOlhfbIK4A/0TOL KgMAoKXMypUhZh7yUB1G/vHhFf09cHNr =Rr5L -----END PGP SIGNATURE-----
mcclnx mcc wrote:> We have CENTOS 5 on DELL server. I tried to setup schedule cron job to run every other week on Saturday (NOT first and third week ). >lets see... date +'%U' returns the week number of the year, 00-51... and (( expression )) evaluates arithmetic expressions, returning 'true' if they are non-zero. weeknumber & 1 will be 0 for even weeks and 1 for odd weeks. So... set up your cron job to run every Saturday, and in the beginning of the job script, do something like... (( $(date +'%V') & 1 )) && exit which will exit if the week of the year is even. or, in the front of your crontab line, something like.... 30 1 * * 6 (($(date +'%V')&1)) && command-you-want-to-execute-on-even-weeks
From: mcclnx mcc <mcclnx at yahoo.com.tw>> We have CENTOS 5 on DELL server. I tried to setup schedule cron job to run > every other week on Saturday (NOT first and third week ).Not tested, might work... maybe: 0 0 8-31/14 * 6 /script.sh 8-31/14 should skip the first week and then go every 2 weeks (unless the /14 takes 1 for base instead of the 8)... JD
From: John Doe <jdmls at yahoo.com>> From: mcclnx mcc > > We have CENTOS 5 on DELL server. I tried to setup schedule cron job to run > > every other week on Saturday (NOT first and third week ). > Not tested, might work... maybe: > 0 0 8-31/14 * 6 /script.sh > 8-31/14 should skip the first week and then go every 2 weeks (unless the /14 > takes 1 for base instead of the 8)...Or, just use 2 entries: 0 0 8-14 * 6 /script.sh 0 0 22-28 * 6 /script.sh JD
From: mcclnx mcc> 0 0 8-31/14 * 6 /script.shFrom: John Doe <jdmls at yahoo.com>> 0 0 8-14 * 6 /script.sh > 0 0 22-28 * 6 /script.shAccording to the man page, neither of these will not do what the OP wants. Both will execute the command EVERY Saturday. The first will also execute it on the 8th and 22nd of the month. The second will execute the command TWICE a day AND days 8-14 AND 22-28. The man pages says if any of the day parameters match, the command is executed. Unfortunately for the OP, the day parameters are an OR operation and not an AND operation. -- Brent L. Bates (UNIX Sys. Admin.) M.S. 912 Phone:(757) 865-1400, x204 NASA Langley Research Center FAX:(757) 865-8177 Hampton, Virginia 23681-0001 Email: B.L.BATES at larc.nasa.gov http://www.vigyan.com/~blbates/