[CentOS] Confusion about scheduling tasks with crontab

Brett Serkez bserkez at gmail.com
Sun Oct 18 15:28:29 UTC 2009


On Sun, Oct 18, 2009 at 11:11 AM, ne... <guhvies at gmail.com> wrote:
> On Sun, Oct 18, 2009 at 16:09, Niki Kovacs <contact at kikinovak.net> wrote:
>
>> I have to setup a scheduled task on a server, and I just read through
>> some crontab docs. Now I'm confused. It's not so much the syntax of the
>> cron job to define (I got that), it's more... how do I get to define it?
>> Use a text editor (vi or the likes) to edit /etc/crontab directly? Or
>> create some empty file in /etc/cron.daily or /etc/cron.hourly or the
>> likes and then edit it using crontab -e ?
> As root, crontab -e. This is all you need.

If the script is to run as root and you aren't overly concerned about
the precise time your script runs, only that it runs at these
intervals, you can place your script or a soft-link to your script in
one of the directories /etc/cron.monthly, /etc/cron.weekly,
/etc/cron.daily and /etc/cron.hourly.

Any output from your script will be emailed to you, if this is setup.

To the best of my knowledge the scripts in these directories are run
in alphabetical order, you can control the order if desired by the
naming of the script.

In this case, crontab -e is not needed, create your script in our
favorite editor.

Brett



More information about the CentOS mailing list