3 # asterix This shell script takes care of starting and stopping
8 # description: Asterisk is an Open Source PBX and telephony development platform that \ \
9 # can both replace a conventional PBX and act as a platform for \
10 # developing custom telephony applications for delivering dynamic \
11 # content over a telephone similarly to how one can deliver dynamic \
12 # content through a web browser using CGI and a web server.
14 # pidfile: /var/run/asterisk.pid
15 # config: /etc/asterisk/asterisk.conf
19 [ -f /etc/asterisk/asterisk.conf ] || exit 0
21 # Source function library
22 . /etc/rc.d/init.d/functions
25 . /etc/sysconfig/network
28 [ -f /etc/sysconfig/asterisk ] && . /etc/sysconfig/asterisk
30 # Check that networking is up.
31 if is_yes "${NETWORKING}"; then
32 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
33 msg_network_down Asterisk
41 # Check if the service is already running?
42 if [ ! -f /var/lock/subsys/asterisk ]; then
44 daemon $SERVICE_RUN_NICE_LEVEL asterisk $ASTERISK_OPTS
46 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/asterisk
48 msg_already_running Asterisk
54 if [ -f /var/lock/subsys/asterisk ]; then
57 rm -f /var/lock/subsys/asterisk >/dev/null 2>&1
59 msg_not_running Asterisk
64 # See how we were called.
77 if [ -f /var/lock/subsys/asterisk ]; then
78 msg_reloading Asterisk
80 asterisk -rx reload > /dev/null 2>&1
82 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/asterisk
85 msg_not_running Asterisk
90 asterisk -rx 'logger reload'
97 msg_usage "$0 {start|stop|restart|force-reload|status}"