Autorun asterisk after reboot with updating /etc/host on QNAP TS-269 Pro
本帖最後由 角色 於 2012-11-2 21:32 編輯
怎样自动启动asterisk?
1) mount /dev/sdx6 /tmp/config
2) cd /tmp/config
3) vi autorun.sh and add the following- #!/bin/sh
- #sym-link ./Optware to /opt
- rm -rf /opt
- ln -sf /share/MD0_DATA/.qpkg/Optware /opt
- #pass the start control to /opt/etc/init.d/asterisk-start.sh
- /share/MD0_DATA/.qpkg/Optware/etc/init.d/asterisk-start.sh &
複製代碼 4) chmod u+x autorun.sh
5) cd /
6) umount /tmp/config
7) cd /opt/etc/init.d
8) vi asterisk-start.sh and add- #!/bin/sh
- {
- ###
- # Section 1: Changes that can be made immediately.
- ###
- #set environment variable
- export LD_LIBRARY_PATH=/opt/lib
- ###
- # Section 2: Wait for it...
- ###
- date; echo "Waiting for boot process to complete."
- while [ ! -f /tmp/.thttpd_alive ]; do
- sleep 1
- done
- date; echo "Boot process completed, making custom changes."
- ###
- # Section 3: Changes after the boot processes have finished.
- ###
- # add 2b host names in /etc/hosts
- cat >>/etc/hosts <<EOD
- 203.80.89.135 s2hkbntel.net s21.hkbntel.net
- EOD
- # start /opt/sbin/asterisk
- /opt/sbin/asterisk
- # start /opt/asterisk-1.8/sbin/asterisk
- /opt/asterisk-1.8/sbin/asterisk
- # start /opt/asterisk-11/sbin/asterisk
- /opt/asterisk-11/sbin/asterisk
- # crontab /xyz/home/userx/crontab -u userx
- # date; echo "autorun_subproc ended."
- } >/tmp/autorun_subproc.out 2>/tmp/autorun_subproc.err &
複製代碼 9. chmod +x ./asterisk-start.sh
10. Reboot using webadmin
11. After reboot, we are able to see three Asterisk servers running in parallel.
Remarks:
1) In Step 8, the file /tmp/.boot_done was replaced by /tmp/.thttpd_alive because file did not appear.
2) Due to the command library called for the Google talk, only the first asterisk could use it, the rest of the two are not able to use it. If you want any particular asterisk to run Google Talk, that asterisk has to be placed at the front of all asterisk starters. |