【问题标题】:Cron is running but not outputting dataCron 正在运行但没有输出数据
【发布时间】:2013-10-31 02:50:43
【问题描述】:

我正在尝试让我的 Amazon EC2 实例通过 crontab 停止和启动。 EC2 Api 工具安装成功。手动即可。

cron(我使用命令 crontab -e 输入):10 * * * * ubuntu /usr/bin/ec2-stop-instances [instanceid] > /tmp/ec2.log

文件 /tmp/ec2.log 已创建。当我使用命令 grep CRON /var/log/syslog 我看到 cron 实际运行了。我在 /tmp/ec2.log 文件中没有得到任何输出。我已经设置了所有需要的亚马逊变量。

即使我故意创建了一个错误的 cron,像这样:10 * * * * ubuntu /usr/bin/ec2-stop-instancwweqes [instanceid] > /tmp/ec2.log

我在文件中没有得到任何输出。不应该有错误吗?我也试过不定义用户:10 * * * * /usr/bin/ec2-stop-instances [instanceid] > /tmp/ec2.log

直接命令:10 * * * * ubuntu ec2-stop-instances [instanceid] > /tmp/ec2.log

谁能帮帮我。如果我能以某种方式调试,我就能找到解决方案。

提前致谢。

【问题讨论】:

    标签: ubuntu amazon-ec2 cron


    【解决方案1】:

    执行 ps -ef | grep crond | grep -v grep 看看 cron 是否正在运行。

    10 * * * * ubuntu /usr/bin/ec2-stop-instancwweqes [instanceid] 2> /tmp/ec2.log

    试试这个,看看 ec2.log 中是否有错误。

    【讨论】:

      猜你喜欢
      • 2021-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多