where 3 denotes the checking frequency to be 3 mintues.
3. 然后用crontab -l, list all the scheduled rules
[/opt/sbin] # crontab -l
# m h dom m dow cmd
0 3 * * 0 /etc/init.d/idmap.sh dump
0 4 * * * /sbin/hwclock -s
0 3 * * * /sbin/vs_refresh
0 3 * * * /sbin/clean_reset_pwd
0-59/15 * * * * /etc/init.d/nss2_dusg.sh
0 4 * * * /etc/init.d/ImRd.sh bgThGen
4 3 * * 3 /etc/init.d/backup_conf.sh
37 * * * * /sbin/qddns_check 2>/dev/null
*/3 * * * * /opt/sbin/cmphone.sh
[/opt/sbin] #
複製代碼
4. cmphone.sh的内容
#!/bin/sh
#/opt/sbin/asterisk -rx "sip reload"
#echo "sip reload at `date`" >> /tmp/cron.log
cmphone_status=`/opt/sbin/asterisk -rx "sip show registry" | grep "No Authentication"`
if [ "$cmphone_status" != "" ]
then
/opt/sbin/asterisk -rx "sip reload"
echo $cmphone_status >> /tmp/cron.log
echo "sip reload at `date`" >> /tmp/cron.log
fi
複製代碼
5. Make cron.sh be executable
chmod +x ./cron.sh
複製代碼
6. Check the crond background process
[/opt/sbin] # ps -aux | grep cron
18808 admin 564 R grep cron
20736 admin 716 S /usr/sbin/crond -l 9 -c /tmp/cron/crontabs
複製代碼
7. Kill 20736
8. Restart the script
/etc/init.d/crond.sh restart
複製代碼
作者: 角色 時間: 2013-2-11 10:31
本帖最後由 角色 於 2013-2-11 11:44 編輯
Synology NAS
Please note the format of Synology crontab is different from the standard (including QNAP NAS). The separator used in Synology crontab is a <TAB> character and not a <SAPCE> character.
1. List the current contents of the cron table (crontab)