crontab重启命令 | 您所在的位置:网站首页 › 重启cron服务 › crontab重启命令 |
服务器不重启的情况下定时自动重启apache及mysql服务,其实也大同小异。具体步骤如下: 一、每天的12点及16点重启apache及mysql服务 [root@www bin]# cd /opt/ [root@www opt]# vim reboot.txt 在reboot.txt.txt文件中输入下面的内容后保存 0 12 * * * service httpd restart 0 12 * * * service mysqld restart 0 16 * * * service httpd restart 0 16 * * * service mysqld restart 二、把新建的文件加入到cron服务中 [root@www opt]# crontab reboot.txt [root@www opt]# crontab -l 0 12 * * * service httpd restart 0 12 * * * service mysqld restart 0 16 * * * service httpd restart 0 16 * * * service mysqld restart 三、重启cron服务 [root@www opt]# /sbin/service crond restart ======================================= 补充说明: cron是一个linux下的定时执行工具,可以在无需人工干预的情况下运行作业。由于Cron 是Linux的内置服务,但它不自动起来,可以用以下的方法启动、关闭这个服务: /sbin/service crond start //启动服务 |
CopyRight 2018-2019 实验室设备网 版权所有 |