我对crontab来说是非常新的,所以这可能是一个很明显的语法错误,但是我不知道问题出在哪里。我查看了许多其他问题的帖子,但我无法缩小问题。
PYTHONPATH =/usr/lib/python3.4/site-packages
MAILTO="email@email.com"
45 13 * * * chmod +x /home/elalo/ServiceNow/scheduler.py >/tmp/out.txt 2>&1
touch /tmp/out.txt
tail /tmp/out.txt
预先感谢。
实际上有几个原因为什么不起作用。
输出文件弄乱了,我不需要包括 chmod a+x
我也没有正确布置的python路径。
正确的方法表示python路径:
/usr/bin/python3.4
然后将路径添加到脚本中,以便总共看起来喜欢
MAILTO="email@address"
30 12 * * * /usr/bin/python3.4 /home/elalo/ServiceNow/scheduler.py
另外,在脚本内部,我在同一目录中引用了文件,这些文件也需要完整的路径。
例如:
scheduler.txt
需要是
/home/elalo/ServiceNow/scheduler.txt