首頁 繪圖設計 工作閒聊 比賽活動 美術討論 標籤 圖片
Script in /etc/cron.daily (Hourly,Weekly) won't Run or Exec
Type(Type) 2012/12/3 11:35

Script in /etc/cron.daily (Hourly,Weekly) won't Run or Execute



Symptoms:
=> Script won't Run or Execute in these Ubuntu Linux Folders
/etc/cron.hourly
/etc/cron.daily
/etc/cron.weekly
/etc/cron.monthly

Possible Check-Points

1. Make sure NO /usr/sbin/anacron existed



Otherwise, we will run "anacron" first before running "run-parts"
代碼:

$ ls -l /usr/sbin/anacron
ls: cannot access /usr/sbin/anacron: No such file or directory

$ grep "*" /etc/crontab
17 *    * * *  root    cd / && run-parts --report /etc/cron.hourly
25 5    * * *  root     test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7  root     test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 7    1 * *  root     test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
                        ^^^^^^^^^^^^^^^^^^^^^^^^^


2. Rename/Remove "dot" and ".sh" from your script filename



Some run-parts parameters has filename name space constraints:

e.g.
代碼:

$ cd /etc/cron.daily/
$ sudo mv daily_backup_userfolder.sh dailybackupuserfolder



3. Make your script executeable



Of course, make them with +x permission.

代碼:

$ cd /etc/cron.daily/
$ sudo chmod 755 <YOUR SCRIPT>



4. Specify proper shell directives (e.g. #!/bin/sh or #!/bin/bash)



Finally, check if there is shell directives at first line.

代碼:

$ cd /etc/cron.weekly
$ sudo vi <YOUR SCRIPT>
  # (... Add a #!/bin/sh at first line ...)



(1,930 views)
[更多討論] 討論區 Windows, Linux, Perl, PHP, C/C++, Driver, Web 理論、應用、硬體、軟體

"Script in /etc/cron.daily (Hourly,Weekly) won't Run or Exec" 傳統頁面(電腦版)

首頁 繪圖設計 工作閒聊 比賽活動 美術討論 標籤 圖片
傳統桌面版 [ 登入/註冊 ]
© Vovo2000.com Mobile Version 小哈手機版 2024