Crontab定时执行
设置一个可执行脚本: test.sh #名字随便起
#!/bin/sh
cd `dirname $0` || exit 1
/usr/bin/python3.5 hello.py >> run.log 2>&1 # 执行命令 执行文件 程序错误日志
在crontab 中设置执行脚本的时间、路径:
# 编辑脚本: crontab -e
* * * * * /home/zdw/test.sh >> /home/zdw/run1.log 2>&1 #执行时间 执行脚本 脚本错误日志
查看crontab内容: crontab -l
其他:
查看Python程序路径: whereis python
查看动态log日志: tail -f run.log