[wplug] Cron Job - Working hours vs. Off hours

Pat Barron pat at tiderium.com
Sun Sep 24 21:46:09 EDT 2006


In the second and third cron entries, you need to specify a specific
minute in the hour for the command to run, otherwise it will run once per
minute during those time periods.  You might also want to specify the full
path to the command (just to avoid $PATH possibly not being what you
expect it to be), and redirect the output of the command (both stdout and
stderr) somewhere, otherwise any output will be mailed to the user to whom
the crontab belongs.

--Pat.



On Sun, 24 Sep 2006, Gentgeen wrote:

>
> I want to set up a cron job that will run "foo" every 5 minutes during 7
> to 6 on weekdays, but run "foo" every hour the rest of the time.  Do I
> have this right:
>
> --- BEGIN CRONTAB --------
> # Runs every 5 minutes during working hours on weekdays
> */5 7-18 * * 1-5 foo
>
> # Runs every hour during none working hours on weekdays
> * 19-6 * * 1-5 foo
>
> # Runs every hour during weekends
> * */1 * * 0,6 foo
>
> --- END CRONTAB ----------
>
>
> Or is there maybe a more eloquent way to do this? (btw this is just a
> user crontab, not a system wide cron (crontab -e as user not root)
>
>
> --
> http://gentgeen.homelinux.org
>
> #############################################################
>  Associate yourself with men of good quality if you esteem
>  your own reputation; for 'tis better to be alone then in bad
>  company.        - George Washington, Rules of Civility
> _______________________________________________
> wplug mailing list
> wplug at wplug.org
> http://www.wplug.org/mailman/listinfo/wplug
>



More information about the wplug mailing list