关于 cron 和 ruby 的快速问题,
我有一个可以运行的脚本
puts `tar etc..`
我正在尝试调试为什么这个脚本没有像它应该的那样对文件进行压缩......
当我手动调用它时它工作正常并且我也看到 tar 输出..
当 put 在 cron 作业中运行时,它实际上会执行任何操作吗?
谢谢
丹尼尔
最佳答案
来自 crontab 帮助页面:
If standard output and standard error are not redirected by commands executed from the crontab entry, any generated output or errors shall be mailed, via an implementation-defined method, to the user.
我通常为调试 crontab 所做的事情是创建一个记录器:
logfile = File.open('/path/to/log.log', 'rw')
logger = Logger.new(logfile)
logger.debug('something')
关于ruby - Cron 和 Ruby.. "puts ` 系统命令`"有什么作用吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5140834/