首先,我可能会使用以下命令将cron配置为自己发送任何输出MAILTO:
在/ etc/crontab中:
MAILTO=username
Run Code Online (Sandbox Code Playgroud)
其次,我通常在我的脚本中添加一些(几乎)不可能失败的东西,如下所示:
#!/bin/sh
echo "$0 ran on `date +%c`" >> /tmp/crontab_test.log
# ... rest of program
Run Code Online (Sandbox Code Playgroud)
如果你直接从cron调用python脚本,你可以做类似的事情或创建一个包装器shell脚本.
| 归档时间: |
|
| 查看次数: |
246 次 |
| 最近记录: |