[英]Crontab and script
I have debian linux. 我有debian Linux。 I've created from user crontab -e
this text: 我从用户crontab -e
创建了此文本:
0 * * * * python /home/user/CronLogic.py
15 * * * * python /home/user/CronLogic.py
30 * * * * python /home/user/CronLogic.py
45 * * * * python /home/user/CronLogic.py
*/1 * * * * date > /tmp/TEST
Last string runs fine but running python script fails with: 最后一个字符串运行正常,但运行python脚本失败并显示:
/bin/sh: 1: /usr/bin/rcssserver: not found
The code is: 代码是:
#!/usr/bin/python
cmd ='/usr/bin/rcssserver'
err = open('CronLogicERRORS', 'a')
server = subprocess.Popen(cmdRes, shell=True, stderr=err)
And the error appears in CronLogicERRORS
file. 并且错误出现在CronLogicERRORS
文件中。 What could be wrong here? 这有什么问题吗? Without cron script runs fine. 没有cron脚本运行正常。
cmd ='/usr/bin/rcssserver'
# ^^^ Too many s's
Now, about your cron
usage: 现在,关于您的cron
使用情况:
Instead of having the same line 4 times, make it one line of 0,15,30,45
, or even better */15
. 与其让同一行出现4次, 0,15,30,45
让它成为0,15,30,45
甚至更好的*/15
。 And your */1
is redundant, just plain *
is better. 而且您的*/1
是多余的,只是简单的*
更好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.