crond是linux下用来周期性的执行某种任务或等待处理某些事件的一个守护进程,与windows下的计划任务类似,当安装完成操作系统后,默认会安装此服务工具,并且会自动启动crond进程,crond进程每分钟会定期检查是否有要执行的任务,如果有要执行的任务,则自动执行该任务。Linux下的任务调度分为两类,系统任务调度和用户任务调度。
minute hour day month week command
yum install crontabs
systemctl enable crond
systemctl start crond
service crond start #启动服务
service crond stop #关闭服务
service crond restart #重启服务
service crond reload #重新载入配置
[root@iZbp120kp0myoxtm8gcnw8Z home]# vi /etc/crontab
[root@iZbp120kp0myoxtm8gcnw8Z home]# crontab /etc/crontab
[root@iZbp120kp0myoxtm8gcnw8Z home]# crontab -l
每天的21:30重启pm2
30 21 * * * root /usr/bin/node /usr/bin/pm2 pm2 restart all >/dev/null 2>&1
©2018-2020 hongshali.com 版权所有 ICP证:闽ICP备18029655号-1