You can use crontab to periodically execute scripts. Generally, crontab started in linux can be directly used. first, paste several service commands: sbinservicecrondstartsbinservicecrondstopsbinservicecrondrestartsbinservice.
Preface
To regularly execute scripts, you can use crontab. Generally, crontab is started in linux and can be directly used. first, paste several service commands:
/Sbin/service crond start
/Sbin/service crond stop
/Sbin/service crond restart
/Sbin/service crond reload
If crontab is not enabled, add/sbin/service crond start to the/etc/rc. d/rc. local script.
1. view, edit, and delete scheduled tasks
Each user has his/her own crontab scheduled task. pay attention to whether the script to be executed requires the root permission. if necessary, switch to the root operation.
(1) view
Use crontab-l
(2) edit and delete
Use crontab-e to add tasks like vi. The syntax is described below. You don't need to delete it. you just need to delete it directly.
2. Syntax
Example: 0 0 ***/home/shell/cut_nginx_log.sh
The first part is 0 0 ***. the execution time is minute, hour, day, month, and week. The example is 00:00 every day.
Part 2/home/shell/cut_nginx_log.sh: script to be executed
OK. is that simple? (^ ω ^ )?