简体   繁体   English

从crontab运行时,Perl中的Carp库在哪里打印日志

[英]Where does, Carp library in Perl, print logs when run from crontab

I have a Perl script that uses Carp (carp croak) to print info and errors. 我有一个使用鲤鱼(鲤鱼叫声)来打印信息和错误的Perl脚本。 When run directly I can see the output on console. 直接运行时,我可以在控制台上看到输出。 But when I am running the script as cronjob I dont know where the messages are going. 但是,当我将脚本作为cronjob运行时,我不知道消息的去向。

Already checked in /var/log/messages /var/log/cron . 已在/ var / log / messages / var / log / cron中签入。 Not found 未找到

Please help. 请帮忙。

我认为您应该在cronjob中重定向标准输出。

man cron : man cron

When executing commands, any output is mailed to the owner of the crontab (or to the user named in the MAILTO environment variable in the crontab, if such exists). 执行命令时,所有输出都将邮寄给crontab的所有者(如果存在,则邮寄给crontab的MAILTO环境变量中命名的用户)。 Job output can also be sent to syslog by using the -s option. 也可以使用-s选项将作业输出发送到syslog。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM