crontab -e

0 4 * * * /root/scripts/mysqlbackup.sh

0 4 * * * /root/scripts/apacherestart.sh

0 5 * * 1,3,5 /usr/bin/python /home/report/report_form.py &>/home/report/log.txt  每周一、周三、周五早上五点执行python脚本report_form.py   

crontab的坑:python需要知名绝对路径(使用命令which python)

重定向的日志需要指定绝对路径

crontab –e : 修改 crontab 文件. 如果文件不存在会自动创建。 

crontab –l : 显示 crontab 文件。 

 crontab -r : 删除 crontab 文件。

crontab -ir : 删除 crontab 文件前提醒用户。

*注意:不希望执行某个定时任务,只需要把crontab -e里面的那行删除掉就可以

相关文章:

  • 2021-06-15
  • 2022-12-23
  • 2022-01-13
  • 2022-12-23
  • 2021-10-07
  • 2022-12-23
  • 2022-12-23
  • 2021-06-18
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-19
  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
  • 2021-07-16
相关资源
相似解决方案