In cronlinux, the server that runs the scheduled task executes the specific task according to the time specified in the configuration file. Cron (ubuntu) startup service servicecronstart close service servicecronstop restart service servicecronrestart re-load configuration service...
In cron linux, the server that runs the scheduled task executes the specific task according to the time specified in the configuration file.
Cron (ubuntu)
Start service cron start
Disable service cron stop
Restart service cron restart
Reload and configure service cron reload
There are two methods to configure cron:
1. use the crontab command
-U is the specified user
-E: edit your cron service
-L list users' cron services
-R: deletes the user's cron service.
For example, crontab-u root-e is used to edit the cron task of the root user.
After entering the editing mode
Display: # m h dom mon dow command
M indicates minute (0-59)
H indicates the hour (0-23)
Dom indicates the date (1-31)
Mon indicates the month (1-12)
Dow indicates that the week (0-6) 0 is Sunday
For example:
30 16 *** echo "Take care of yourself !" >/Dev/null
At 04:30, run echo "Take care of yourself !"
2. modify the/etc/crontab file
Vim is displayed
# M h dom mon dow user command
User
For example: 01 **** root run-parts/etc/cron. hourly
Execute scripts in/etc/cron. hourly every hour
Run-parts indicates executing scripts in the folder.
Run-parts can be removed and script commands can be directly added.
The other method is the same as the first method.