问题:Could not open input file,定时任务启动失败
example:*/2 * * * * python /var/www/html/kjm/pidCheck.py (crontab)
代码:
import commands
import os
cmd=commands.getoutput("ps -ef |grep 'makfile.php' |grep -v 'grep'" )
cmd=str(cmd)
if cmd == '':
// os.system("php makfile.php &")//(error:Could not open input file)
os.system("cd /var/www/html/kjm/ && php makfile.php &")
else :
pass
result:当调用的脚本和当前在一个目录下因为环境不同可能导致移植代码的时候可能因为配置不同出错