crontab 4th Tuesday of month
15 18 22-28 * 2 /command
I thought the last tuesday would be covered by above. But it has run everyday since 22nd. Have googled a bit: http://hintsforums.macworld.com/showthread.php?t=25110 plus other crontab pages. http://hintsforums.macworld.com/member.php?s=2584787478dc5ab0791da9ba8d650aa5&u=28 924 15 18 22-28 * * test 'date +\%a' != Tue || /command Am uncertain if above would work ootb. man crontab (22 September 2010) doesn't shed light on this. -- Regards, Frank "Jack of all, fubars" -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org |
crontab 4th Tuesday of month
On Sat, 28 Jul 2012 12:03:09 +0100, Frank Murphy wrote:
> 15 18 22-28 * 2 /command > > I thought the last tuesday would be covered by above. > But it has run everyday since 22nd. > > Have googled a bit: > http://hintsforums.macworld.com/showthread.php?t=25110 > plus other crontab pages. > > http://hintsforums.macworld.com/member.php?s=2584787478dc5ab0791da9ba8d650aa5&u=28 924 > 15 18 22-28 * * test 'date +\%a' != Tue || /command > Am uncertain if above would work ootb. > > man crontab (22 September 2010) doesn't shed light on this. From the manual: Note: The day of a command's execution can be specified in the follow‐ ing two fields — 'day of month', and 'day of week'. If both fields are restricted (i.e., do not contain the "*" character), the command will be run when either field matches the current time. For example, "30 4 1,15 * 5" would cause a command to be run at 4:30 am on the 1st and 15th of each month, plus every Friday. That matches your example. -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org |
crontab 4th Tuesday of month
On 28/07/12 12:53, Michael Schwendt wrote:
On Sat, 28 Jul 2012 12:03:09 +0100, Frank Murphy wrote: 15 18 22-28 * 2 /command I thought the last tuesday would be covered by above. But it has run everyday since 22nd. Have googled a bit: http://hintsforums.macworld.com/showthread.php?t=25110 plus other crontab pages. http://hintsforums.macworld.com/member.php?s=2584787478dc5ab0791da9ba8d650aa5&u=28 924 15 18 22-28 * * test 'date +\%a' != Tue || /command Am uncertain if above would work ootb. man crontab (22 September 2010) doesn't shed light on this. From the manual: Note: The day of a command's execution can be specified in the follow‐ ing two fields — 'day of month', and 'day of week'. If both fields are restricted (i.e., do not contain the "*" character), the command will be run when either field matches the current time. For example, "30 4 1,15 * 5" would cause a command to be run at 4:30 am on the 1st and 15th of each month, plus every Friday. that was the crontab I used. That matches your example. I mean man crontab, didn't give example for 4th m w.. of month -- Regards, Frank "Jack of all, fubars" -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org |
crontab 4th Tuesday of month
On 07/28/2012 07:03 AM, Frank Murphy wrote:
> I thought the last tuesday would be covered by above. > But it has run everyday since 22nd. Hi, There's no way to accomplish this via crontab itself. You'll need a little help by means of a script. This works: 1) create the following script. Let's call it tuesday-check.sh: #/bin/sh [ `date +%m` -ne `date -d "+7 days" +%m` ] && your-actual-command.sh 2) create a crontab entry for the above script so that it runs every Tuesday (yes I know you want the last Tuesday; the script will precisely check that): 15 18 * * 2 /root/bin/tuesday-check.sh Explanation: date +%m ...returns the *month number* for today date -d "+7 days" +%m ...returns the "month number" for this day *one week ahead* For example, if I were to run this on the last Saturday of the month (today the 28th): - the first command would return "7". - the second command would return "8" because the NEXT Saturday is already August. Because both of the returned numbers are different (7 and 8) the command will run. HTH, Jorge -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org |
crontab 4th Tuesday of month
On 28/07/12 13:50, Jorge Fbregas wrote:
On 07/28/2012 07:03 AM, Frank Murphy wrote: I thought the last tuesday would be covered by above. But it has run everyday since 22nd. Hi, There's no way to accomplish this via crontab itself. You'll need a little help by means of a script. This works: 1) create the following script. Let's call it tuesday-check.sh: #/bin/sh [ `date +%m` -ne `date -d "+7 days" +%m` ] && your-actual-command.sh Will check this for next Tuesday. Thank everybody for the replies. -- Regards, Frank "Jack of all, fubars" -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org |
crontab 4th Tuesday of month
On Saturday 28 July 2012 12:03:09 Frank Murphy wrote:
> 15 18 22-28 * 2 /command > > I thought the last tuesday would be covered by above. > But it has run everyday since 22nd. > > Have googled a bit: > http://hintsforums.macworld.com/showthread.php?t=25110 > plus other crontab pages. > > http://hintsforums.macworld.com/member.php?s=2584787478dc5ab0791da9 > ba8d650aa5&u=28924 15 18 22-28 * * test 'date +\%a' != Tue || > /command > Am uncertain if above would work ootb. > > man crontab (22 September 2010) doesn't shed light on this. > Try the following eg. this picks out the first sunday of the month 07 03 1-7 * * test `date +\%a` = Sun && /usr/local/bin/backup-full So 15 18 22-28 * * test 'date +\%a' = Tue && command Tony -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org |
crontab 4th Tuesday of month
On 07/28/2012 09:10 AM, Frank Murphy wrote:
> Will check this for next Tuesday. I just noticed now... I quoted your message where you state "last tuesday" but your Subject says "4th Tuesday of month" which are totally different things. My example was based on the last Tuesday. -- Jorge -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org |
crontab 4th Tuesday of month
On 07/28/2012 08:20 AM, Tony Molloy wrote:
On Saturday 28 July 2012 12:03:09 Frank Murphy wrote: 15 18 22-28 * 2 /command I thought the last tuesday would be covered by above. But it has run everyday since 22nd. Have googled a bit: http://hintsforums.macworld.com/showthread.php?t=25110 plus other crontab pages. http://hintsforums.macworld.com/member.php?s=2584787478dc5ab0791da9 ba8d650aa5&u=28924 15 18 22-28 * * test 'date +\%a' != Tue || /command Am uncertain if above would work ootb. man crontab (22 September 2010) doesn't shed light on this. Try the following eg. this picks out the first sunday of the month 07 03 1-7 * * test `date +\%a` = Sun && /usr/local/bin/backup-full So 15 18 22-28 * * test 'date +\%a' = Tue && command Tony Not sure if your syntax will work. If it doesn't, here's what has worked for me: 23 1 22-28 * * [ `date +\%a` == "Tue" ] && /usr/local/bin/my-script Charlie -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org |
crontab 4th Tuesday of month
On 07/29/2012 02:33 PM, Charlie Brune wrote:
On 07/28/2012 08:20 AM, Tony Molloy wrote: On Saturday 28 July 2012 12:03:09 Frank Murphy wrote: 15 18 22-28 * 2 /command I thought the last tuesday would be covered by above. But it has run everyday since 22nd. Have googled a bit: http://hintsforums.macworld.com/showthread.php?t=25110 plus other crontab pages. http://hintsforums.macworld.com/member.php?s=2584787478dc5ab0791da9 ba8d650aa5&u=28924 15 18 22-28 * * test 'date +\%a' != Tue || /command Am uncertain if above would work ootb. man crontab (22 September 2010) doesn't shed light on this. Try the following eg. this picks out the first sunday of the month 07 03 1-7 * * test `date +\%a` = Sun && /usr/local/bin/backup-full So 15 18 22-28 * * test 'date +\%a' = Tue && command Tony Not sure if your syntax will work. If it doesn't, here's what has worked for me: 23 1 22-28 * * [ `date +\%a` == "Tue" ] && /usr/local/bin/my-script Charlie If you are firing off a script with this why don't you build the logic into the script? Let cron fire off the script every Tuesday. The script can determine if it's the correct Tuesday and take whatever action you want if it is or exit if it isn't. -- _ v /(_) ^ ^ Mark LaPierre Registerd Linux user No #267004 www.counter.li.org **** -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org |
crontab 4th Tuesday of month
On 07/29/2012 02:28 PM, Mark LaPierre wrote:
On 07/29/2012 02:33 PM, Charlie Brune wrote: On 07/28/2012 08:20 AM, Tony Molloy wrote: On Saturday 28 July 2012 12:03:09 Frank Murphy wrote: 15 18 22-28 * 2 /command I thought the last tuesday would be covered by above. But it has run everyday since 22nd. Have googled a bit: http://hintsforums.macworld.com/showthread.php?t=25110 plus other crontab pages. http://hintsforums.macworld.com/member.php?s=2584787478dc5ab0791da9 ba8d650aa5&u=28924 15 18 22-28 * * test 'date +\%a' != Tue || /command Am uncertain if above would work ootb. man crontab (22 September 2010) doesn't shed light on this. Try the following eg. this picks out the first sunday of the month 07 03 1-7 * * test `date +\%a` = Sun && /usr/local/bin/backup-full So 15 18 22-28 * * test 'date +\%a' = Tue && command Tony Not sure if your syntax will work. If it doesn't, here's what has worked for me: 23 1 22-28 * * [ `date +\%a` == "Tue" ] && /usr/local/bin/my-script Charlie If you are firing off a script with this why don't you build the logic into the script? Let cron fire off the script every Tuesday. The script can determine if it's the correct Tuesday and take whatever action you want if it is or exit if it isn't. That would work too. It's just a matter of taste and where you want scheduling logic to be. I prefer to have all of the logic on when the script should run is in one place. That way, if I change my mind on when the script runs, I only have one file to examine and edit to change it. -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org |
| All times are GMT. The time now is 10:15 PM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.