A brief introduction to the cron service of the ubuntu system


Install cron on ubuntu

Installation: apt-get install cron
Start: service cron start
Restart: service cron restart
Stop: service cron stop
Check status: service cron status
Query available commands for cron: service cron
Check whether the Cronta tool is installed: crontab -l


Remove a scheduled cron job using
crontab -r


Use the following command to list the cron jobs scheduled by the current user.
crontab -l


Edit Cron jobs
When you enter for the first time, you need to select an editor. After you choose, you can configure a new cron job. Generally, choose 3
crontab -e


Command line input: crontab -e enter and write the script you want to execute
*/1 * * * * /opt/ execute once every minute
*/5 * * * * /opt/ execute every five minutes
0 */1 * * * /opt/ Execute every hour
30 1 * * * /opt/ Execute once every day at 1:30
0 23-7/2, 8 * * * Every two hours between 11pm and 8am and 8am Point
0 11 4 * 1-3 On the 4th of every month and every Monday to Wednesday at 11:22 am 4 * * 0 Execute 42 4 1 * *
every week (Sunday 4:22 am)
month (4:42 am on the 1st) to execute

Guess you like

Origin blog.csdn.net/u013558123/article/details/131257756