zgzy

1、先查看是否安装crond

yum list installed | grep cron

若没有安装:

yum -y install vixie-cron

yum -y install crontable

2、查看crond的config 2,3,4,5是否开启

chkconfig --list

若2.3.4.5 项为off   

则输入以下命令   

chkconfig crond on

3、查看启动状态

service crond status

若没有启动,则启动

service crond start

4、查看当前用户的自动定时任务列表

crontab -l

5、新建定时任务

crontab -e

按任意键进入编辑,输入:

0 6 */1 * * /sbin/reboot
0 6 */1 * * echo reboot done >> /root/a.txt

说明:每日6点自动重启;

每日6点自动输出“reboot done”到a.txt

6、重启服务

service crond restart

7、自动任务路径

/var/log/cron

 

分类:

技术点:

相关文章:

  • 2021-10-02
  • 2021-10-02
  • 2021-10-02
  • 2022-01-02
  • 2021-11-04
  • 2021-10-02
猜你喜欢
  • 2021-11-04
  • 2021-05-30
  • 2021-10-02
  • 2021-10-02
  • 2021-10-02
  • 2021-10-02
  • 2021-08-29
相关资源
相似解决方案