Re: crontab 4th Tuesday of month

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxxxxx
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


[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux