Crontab scheduled task
With the crontab command, we can execute specified system directives or shell scripts at regular intervals.
The unit of time interval can be any combination of minutes, hours, days, months, weeks, and above. This command is ideal for periodic log analysis or data backup.
The format of the schedule is as follows:
F1 f2 f3 f4 f5 program
Before submitting a crontab file to the cron process, first set the environment variable EDITOR. The cron process uses it to determine which editor to use to edit the crontab file. 9 9 % of UNIX and Linux users use vi. If you do the same, then you can edit the .profile file in the $HOME directory and add a line like this:
EDITOR=vi; export EDITOR
Instance
Execute /bin/ls every 0th hour of every month
0 * * * * /bin/ls
In December, every day from 6 am to 12 am, every 3 hours and 0 minutes is executed /usr/bin/backup
0 6-12/3 * 12 * /usr/bin/backup