作者shihyu (shihyu)
看板Python
标题[问题] crontab 定时执行无效
时间Mon Sep 11 00:45:00 2017
https://gist.github.com/anonymous/fef463be1df3bb9aa7a8456803b808ec
我手动下command 执行可以产生文件档 , 可能是用 crontab 每分钟执行确无效
*/1 * * * * /home/shihyu/anaconda2/bin/python /home/shihyu/getubike/getubike.py
我用绝对路径应该没问题 但是就是没作用不知道是什麽原因?
谢谢
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 175.181.175.133
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1505061904.A.50F.html
1F:→ uranusjr: 1. 去看你的 cron log 有没有错误 09/11 00:52
2F:→ uranusjr: 2. Redirect stderr 到一个档案看有没有 exception 09/11 00:53
3F:推 ckc1ark: code里面档案路径先用绝对路径试试 09/11 01:26
4F:推 f496328mm: *後面要接 python3 09/11 07:59
5F:→ f496328mm: 你没打python,就算在分cmd一样是error 09/11 08:00
6F:→ zerof: 输出的位置错了吧, cwd 不是 /home/<username> 09/11 09:53
7F:→ shihyu: 测试结果是 code里面档案路径要绝对路径! 09/11 13:50
8F:推 cphe: 如果不用绝对路径,就是在phython执行档前加个 cd + path; 09/11 19:56
9F:→ wennie0433: /usr/bin/python *.py > /tmp/debug.log 2>&1 印debug 09/11 22:38
10F:→ moon2519: 如果你是ubuntu,可能是dash问题。 09/16 23:52