mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-05-05 03:18:00 +02:00
asterisk: move initscript to src/initscripts/packages and use new macro
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
This commit is contained in:
69
src/initscripts/packages/asterisk
Normal file
69
src/initscripts/packages/asterisk
Normal file
@@ -0,0 +1,69 @@
|
||||
#!/bin/sh
|
||||
########################################################################
|
||||
# Begin $rc_base/init.d/asterisk
|
||||
#
|
||||
# Description : Asterisk Script
|
||||
#
|
||||
# Authors : Michael Tremer (mitch@ipfire.org)
|
||||
#
|
||||
# Version : 01.00
|
||||
#
|
||||
# Notes :
|
||||
#
|
||||
########################################################################
|
||||
|
||||
. /etc/sysconfig/rc
|
||||
. ${rc_functions}
|
||||
|
||||
case "${1}" in
|
||||
start)
|
||||
boot_mesg "Starting Asterisk PBX..."
|
||||
loadproc /usr/sbin/asterisk -p
|
||||
;;
|
||||
|
||||
stop)
|
||||
boot_mesg "Stopping Asterisk PBX..."
|
||||
asterisk -rx "core stop gracefully" >/dev/null 2>&1
|
||||
evaluate_retval
|
||||
;;
|
||||
|
||||
reload)
|
||||
boot_mesg "Reloading Asterisk PBX..."
|
||||
asterisk -rx "reload" >/dev/null 2>&1
|
||||
evaluate_retval
|
||||
;;
|
||||
|
||||
restart)
|
||||
${0} stop
|
||||
sleep 1
|
||||
${0} start
|
||||
;;
|
||||
|
||||
status)
|
||||
statusproc /usr/sbin/asterisk > /tmp/ast 2>&1
|
||||
STAT=$(cat /tmp/ast)
|
||||
rm -f /tmp/ast
|
||||
echo $STAT
|
||||
EX_Z=$(echo $STAT | grep "not" | wc -l)
|
||||
exit $EX_Z
|
||||
;;
|
||||
|
||||
remod)
|
||||
case "${2}" in
|
||||
sip)asterisk -rx "sip reload" >/dev/null 2>&1 ;;
|
||||
iax)asterisk -rx "iax2 reload" >/dev/null 2>&1 ;;
|
||||
ext)asterisk -rx "dialplan reload" >/dev/null 2>&1 ;;
|
||||
*) echo "Usage: ${0} remod {sip|iax|ext}"; exit 1 ;;
|
||||
esac
|
||||
;;
|
||||
|
||||
test) touch /tmp/test$$
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: ${0} {start|stop|reload|restart|status|remod}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# End $rc_base/init.d/asterisk
|
||||
Reference in New Issue
Block a user