小编Hen*_*ryM的帖子

如何设置权限以便作业从 cron 运行

我有运行良好的 python 脚本。我想每 10 分钟将它作为 cron 作业运行一次

我已经完成crontab -e并进入了行

*/10 * * * * root python /path/to/script/script.py
Run Code Online (Sandbox Code Playgroud)

它似乎没有运行。

所以我在命令行上玩过,看看它在什么时候停止运行。它在它的目录中运行,并且在它之前的每个目录中运行,直到我移出我的主目录(即,如果我在其中,/home/henry/则它会运行,但如果我在,例如,/var则它不会)当我收到权限错误时试图写入文件。

# save this for next time
with open(mycsvfile, "w") as outfile:
    writer = csv.writer(outfile)
    writer.writerows([s.strip().encode("utf-8") for s in row ]for row in list_of_rows)
outfile.close()
Run Code Online (Sandbox Code Playgroud)

我已经chmod +x /home/user/Location/Of/Script确保脚本可以访问(我认为)。我错过了什么?谢谢你的帮助

permissions scripts cron

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

cron ×1

permissions ×1

scripts ×1