haoxianrui

需求说明

系统配置低了,且应用程序内一直在执行定时任务,在程序运行一段时间后,发现接口请求会变得很慢,需要每天定时凌晨重启服务器

脚本实现

1. linux 终端输入crontab -e,添加定时任务脚本命令

[root@localhost ~]#  crontab -e

2. 在文件末尾追加

0 0 * * * /sbin/reboot;

3. 重启服务让定时任务生效

systemctl restart crond

4. 配置定时任务开机自启

查看服务是否开机自启

systemctl list-unit-files|grep crond.service

如果没有开机自启,设置开机自启

systemctl enable crond

分类:

技术点:

相关文章:

  • 2021-11-03
  • 2021-10-18
  • 2021-12-27
  • 2021-12-02
  • 2021-11-13
  • 2021-11-03
  • 2021-11-21
  • 2021-12-15
猜你喜欢
  • 2021-11-03
  • 2021-10-18
  • 2021-11-03
  • 2021-07-26
  • 2021-10-02
  • 2021-11-18
  • 2021-11-03
相关资源
相似解决方案