Scheduled Cron Jobs

The Cron Jobs module is used for editing the crontab on your system. Cron is a daemon that runs constantly on most UNIX systems and allows users and the administrator to run specified tasks automatically at selected times. Ordinarily, crond is configured from the system-wide crontab as well as one or more configuration directories in /etc/cron.d, and on Red Hat Linux systems and some other Linux distributions. crond draws its configuration from /etc/cron.hourly, /etc/ cron.daily, /etc/cron.weekly, and /etc/cron.monthly. Note that even on Red Hat and similar systems, /etc/cron.d and /etc/crontab still exist and can be used just as on any other UNIX system.

Configuration of crond is much simplified by use of the Webmin module. To create a new cron job, click Create a new cron job. The Create Cron Job page (Figure 5-7) allows you to select the user that the cron job will run as, thereby limiting its permissions to those of the selected user. As in all permissions situations, it is best to choose a user with the least permissions required to actually accomplish the task needed. There are fields for entering the Command you want to be executed, as well as for any Input to command you might have. The Active option dictates whether the command is enabled or disabled by commenting it out with a hash mark at the beginning of the line.

click to expand
Figure 5-7: Create Cron Job

In Figure 5-7, I’ve created a cron job that is run as a user named backup (a user I’ve created just for such tasks). The job is Active, so it will run at the specified times. The command that is being run is a simple tar command line to back up my complete /etc directory to a tarball in /home/backup. While this is not a terribly sophisticated backup system, it gets the job done without much complexity. Furthermore, a simple periodic backup of important files is far better than no backup at all. In this case, it is made slightly more effective by the fact that /etc and /home are partitions on two different hard disks.



The Book of Webmin... or How I Learned to Stop Worrying and Love UNIX
The Book of Webmin: Or How I Learned to Stop Worrying and Love UNIX
ISBN: 1886411921
EAN: 2147483647
Year: 2006
Pages: 142
Authors: Joe Cooper

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net