drzrzzkh462254 2010-10-26 13:23
浏览 51
已采纳

无法在我的Linux服务器上触发Cron事件[关闭]

I have a Amazon EC2 Linux micro instance server that I need to fire an hourly process on. I have chosen to use crontab and cannot get it to fire.

I placed a *.sh file in the /etc/cron.hourly

  • If I run $ sh /etc/cron.hourly/notify.sh the script behaves as expected.
  • I have checked to see if the cron service is running and it is.
  • I have checked crontab contents are at the end

notify.php logs when it is called so I can tell that the service is never running. Any ideas?

Thanks

contents of: /etc/cron.hourly/notify.sh

curl localhost/notify.php

contents of: /etc/crontab

SHELL=/bin/bash  
PATH=/sbin:/bin:/usr/sbin:/usr/bin  
MAILTO=root   HOME=/       

# run-parts  
01 * * * * root run-parts /etc/cron.hourly  
02 4 * * * root run-parts /etc/cron.daily  
22 4 * * 0 root run-parts /etc/cron.weekly  
42 4 1 * * root run-parts /etc/cron.monthly 
  • 写回答

3条回答 默认 最新

  • douxian5076 2010-10-26 17:41
    关注

    I added this line to /etc/crontab

    * * * * * root curl /etc/notify.sh >>/var/log/cron.log
    

    This created output ever minute that helped me track down the issue. In the end I had a typo in the script.

    Thanks for everyone's help!!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?