因为每次reboot,系统都能活一个星期,而有些member因为每天都关机,所以一直没有发现任何问题。现在我再建一个routine,就是每一个凌晨4点,系统都会自动重新启动一次。
RebootTime.sh (放在/persistent/etc)- #!/bin/sh
- while [ 1 ]
- do
- TIME=`date | cut -c 12-16`
- echo $TIME
- if [ "$TIME" == "04:00" ]
- then
- reboot
- fi
- sleep 55
- done
複製代碼 而在/etc/init.d/asterisk里加上面的信息- #!/bin/sh
- # Start up file for Asterisk
- # NOTE: we set the TZ before starting as otherwise (when starting from
- # /etc/rc) this env variable won't be available to the shell that
- # starts Asterisk and the time will be messed up.
- case $1 in
- start) export TZ=`cat /etc/TZ`;
- /bin/sh /etc/gen_checklist.sh >/dev/null 2>/dev/nul #added by YH Fung April 12, 2010
- /bin/sh /etc/checkip.sh >/dev/null 2>/dev/nul & #added by YH Fung April 12, 2010
- /bin/sh /etc/IsAsteriskAlive.sh >/dev/null 2>/dev/nul & #added by YH Fung July 19, 2010
- /bin/sh /etc/RebootTime.sh >/dev/null 2>/dev/nul & #added by YH Fung July 20, 2010
- asterisk -f >/dev/null 2>/dev/null & ;;
- stop) killall -9 asterisk;;
- restart) asterisk -r -x "stop now";
- /etc/init.d/asterisk start;;
- enable) rm -f /persistent/etc/rc.d/S50asterisk;
- ln -s /persistent/etc/init.d/asterisk /persistent/etc/rc.d/S50asterisk;;
- disable) rm -f /persistent/etc/rc.d/S50asterisk;;
- *) cat <<EOF;;
- Syntax: /etc/init.d/asterisk [command]
- Available commands:
- start Start the service
- stop Stop the service
- restart Restart the service
- enable Enable service autostart
- disable Disable service autostart
- EOF
- esac
複製代碼 角色 |