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条)

报告相同问题?

悬赏问题

  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集