cron
The cron
service can be used to schedule file execution at specific times. Daemon can be managed via the /etc/init.d/crond
interface, and cron tables managed via crontab
.
Usage:
crontab [options] file
crontab [options]
crontab -n [hostname]
Options:
Options | Description |
---|---|
-u <user>
|
define user |
-e
|
edit user's crontab |
-l
|
list user's crontab |
-r
|
delete user's crontab |
-i
|
prompt before deleting |
-n <host>
|
set host in cluster to run users' crontabs |
-c
|
get host in cluster to run users' crontabs |
-x <mask>
|
enable debugging |
To perform start/stop/restart on crond
service:
/etc/init.d/crond start
To verify the current crond status:
/etc/init.d/crond status
To check current cron jobs running with the following command to list all crontabs:
crontab -l
To edit or create a custom crontab file:
crontab -e
This opens a personal cron
configuration file. Each line can contain one command to run. The following format is used:
minute hour day-of-month month day-of-week command
For example, the following entry will run a the specified backup.sh script every day at 3am:
0 3 * * * /etc/config/backup.sh
When finished, save and close the crontab
file.