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/asterisk.pid
15 # config: /etc/asterisk/asterisk.conf
17 # Source function library
18 . /etc/rc.d/init.d/functions
21 . /etc/sysconfig/network
23 # Specify the configuration file
24 AST_CONFIG=/etc/asterisk/asterisk.conf
26 # The user that Asterisk will run as.
29 # If a user is specified above, Asterisk will change the group it runs
30 # as to the primary group of the user, as well as initialize the
31 # supplementary groups. If you want to run Asterisk as a different
32 # group, set AST_GROUP to the group that Asterisk should run as. Note
33 # that this may break DAHDI devices as supplementary groups will not
38 [ -f /etc/sysconfig/asterisk ] && . /etc/sysconfig/asterisk
40 # Check that networking is up.
41 if is_yes "${NETWORKING}"; then
42 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
43 msg_network_down "Asterisk"
51 # Check if the service is already running?
52 if [ -f /var/lock/subsys/asterisk ]; then
53 msg_already_running "Asterisk"
57 msg_starting "Asterisk"
58 if [ $AST_USER ] ; then
59 AST_ARGS="-U $AST_USER"
61 if [ $AST_GROUP ] ; then
62 AST_ARGS="$AST_ARGS -G $AST_GROUP"
64 if [ $AST_CONFIG ]; then
65 AST_ARGS="$AST_ARGS -C $AST_CONFIG"
67 daemon /usr/sbin/asterisk $AST_ARGS $ASTERISK_OPTS
70 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/asterisk
75 if [ ! -f /var/lock/subsys/asterisk ]; then
76 msg_not_running "Asterisk"
80 msg_stopping "Asterisk"
82 rm -f /var/lock/subsys/asterisk >/dev/null 2>&1
86 if [ ! -f /var/lock/subsys/asterisk ]; then
87 msg_not_running "Asterisk"
97 if [ ! -f /var/lock/subsys/asterisk ]; then
99 msg_not_running "Asterisk"
103 msg_reloading "Asterisk"; busy
104 /usr/sbin/asterisk -rx reload > /dev/null 2>&1
106 if [ $RETVAL -eq 0 ]; then
107 touch /var/lock/subsys/asterisk
115 # See how we were called.
134 /usr/sbin/asterisk -rx "logger reload"
141 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|logger-reload|status}"