2010-10-26 13:23



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?


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

curl localhost/notify.php

contents of: /etc/crontab

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 
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • douxian5076 douxian5076 11年前

    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!!

    点赞 评论 复制链接分享
  • donglv9813 donglv9813 11年前

    I'd recommend to check the file permissions. x-bit should be set. Another thing is #!/bin/sh in the first line of your script. Last one probably isn't necessary.

    点赞 评论 复制链接分享
  • donglvmang8638 donglvmang8638 11年前

    Sounds like the environment might differ; try something like /bin/echo hello world (use which to find their echo). If that works, it's probably a $PATH problem.

    点赞 评论 复制链接分享