diff options
author | Philipp Zabel <philipp.zabel@gmail.com> | 2007-06-22 17:57:39 +0000 |
---|---|---|
committer | Philipp Zabel <philipp.zabel@gmail.com> | 2007-06-22 17:57:39 +0000 |
commit | b669962c250fb4a2a8c5badfe5b3717569b80abc (patch) | |
tree | b75f8720b17f1fe93c76dc19407dc86cd73ad555 /packages/asterisk/files/init | |
parent | a14b857a5eb21816991ca6ec50c9520f9bcc61dd (diff) | |
parent | 2f7f445a9c6463ce4a7cec1844911085b1536b1c (diff) |
merge of 'a9d59f7c5db704e36d7f7dbda87b750cabbbc775'
and 'fcf3721db5cf2d3c669e8d3d36cd3ca4df792f6f'
Diffstat (limited to 'packages/asterisk/files/init')
-rw-r--r-- | packages/asterisk/files/init | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/packages/asterisk/files/init b/packages/asterisk/files/init new file mode 100644 index 0000000000..1ece638c22 --- /dev/null +++ b/packages/asterisk/files/init @@ -0,0 +1,77 @@ +#! /bin/sh +# +# This is an init script for openembedded +# Copy it to /etc/init.d/openpbx and type +# > update-rc.d asterisk14 defaults 60 +# +asterisk=/usr/sbin/asterisk +pidfile=/var/run/asterisk/asterisk.pid +asterisk_args="-npqT -U asterisk -G asterisk" + +test -x "$asterisk" || exit 0 + +case "$1" in + start) + echo -n "Starting Asterisk" + start-stop-daemon --start --quiet --exec $asterisk -- $asterisk_args + echo "." + ;; + stop) + echo -n "Stopping Asterisk" + $asterisk -rx "stop gracefully" + sleep 4 + if [ -f $pidfile ]; then + start-stop-daemon --stop --quiet --pidfile $pidfile + fi + echo "." + ;; + force-stop) + echo -n "Stopping Asterisk" + $asterisk -rx "stop now" + sleep 2 + if [ -f $pidfile ]; then + start-stop-daemon --stop --quiet --pidfile $pidfile + fi + echo "." + ;; + restart) + echo -n "Restarting Asterisk" + if [ -f $pidfile ]; then + $asterisk -rx "restart gracefully" + sleep 2 + else + start-stop-daemon --start --quiet --exec $asterisk -- $asterisk_args + fi + echo "." + ;; + force-restart) + echo -n "Forcibly Restarting Asterisk" + if [ -f $pidfile ]; then + $asterisk -rx "restart now" + sleep 2 + else + start-stop-daemon --start --quiet --exec $asterisk -- $asterisk_args + fi + echo "." + ;; + reload) + echo -n "Reloading Asterisk Configuration" + if [ -f $pidfile ]; then + $asterisk -rx "reload" + else + start-stop-daemon --start --quiet --exec $asterisk -- $asterisk_args + fi + echo "." + ;; + logger-reload) + if [ -f $pidfile ]; then + $asterisk -rx "logger reload" + fi + ;; + *) + echo "Usage: /etc/init.d/asterisk {start|stop|force-stop|restart|force-restart|reload|logger-reload}" + exit 1 +esac + +exit 0 + |