LOADING

Centos安装定时任务

原创文章5年前 (2020)发布 fdadmin
5,025 1 0

1.检查定时任务是否存在

rpm -q yum-cron

2.安装定时任务

yum -y install cronie shell yum -y install yum-cron

注:单独安装yum-cron也可以,因为yum会自动检测到yum-cron需要一来到cronie然后自动安装
3.启动启动和停止
3-1.启动

systemctl start crond systemctl start yum-cron

3-2.停止

systemctl stop yum-cron systemctl stop crond

3-3.查看状态

systemctl status crond.service

4.重新加载

systemctl reload crond.service

5.重新启动

systemctl restart crond.service

6.卸载

yum -y remove yum-cron yum -y remove cronie

7.设置开机启动

systemctl enable crond.service

8.查看当前crontab

crontab -l

9.编辑crontab

crontab -e

*/1 * * * * echo “这是一个日志分割定时任务” >> /application/logs/cron.log
10.重新加载

systemctl reload crond.service

11.卸载corntab

crontab -r
© 版权声明

相关文章

1 条评论

  • techfd
    techfd 管理员
    学习了
    中国陕西西安市 电信
    回复