2 # $Id: asterisk,v 1.2 2004/07/18 20:24:07 Gregory Boehnlein <damin@nacs.net>
4 # asterisk Starts, Stops and Reloads Asterisk.
6 # chkconfig: 2345 40 60
7 # description: Asterisk PBX and telephony daemon.
8 # processname: asterisk
9 # pidfile: /var/run/asterisk.pid
11 # Sun Jul 18 2004 Gregory Boehnlein <damin@nacs.net>
12 # - Updated Version to 1.2
13 # - Added test for safe_asterisk
14 # - Verified SIGTERM issued by "killproc" ensures "stop gracefully"
15 # - Added support for -U and -G command line options
16 # - Modified "reload" to call asterisk -rx 'reload'
18 # Source function library.
19 . /etc/rc.d/init.d/functions
21 [ -x /usr/sbin/asterisk ] || exit 0
22 [ -d /etc/asterisk ] || exit 0
24 # Leave this set unless you know what you are doing.
25 export LD_ASSUME_KERNEL=2.4.1
27 # Full path to asterisk binary
28 DAEMON=/usr/sbin/asterisk
30 # Full path to safe_asterisk script
31 SAFE_ASTERISK=/usr/sbin/safe_asterisk
33 # Uncomment the following and set them to the user/groups that you
34 # want to run Asterisk as. NOTE: this requires substantial work to
35 # be sure that Asterisk's environment has permission to write the
36 # files required for its operation, including logs, its comm
37 # socket, the asterisk database, etc.
45 echo -n $"Starting asterisk: "
46 if [ -f $SAFE_ASTERISK ] ; then
49 if [ $AST_USER ] ; then
50 ASTARGS="-U $AST_USER"
52 if [ $AST_GROUP ] ; then
53 ASTARGS="`echo $ASTARGS` -G $AST_GROUP"
55 daemon $DAEMON $ASTARGS
57 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/asterisk
64 echo -n $"Shutting down asterisk: "
67 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/asterisk
78 $DAEMON -rx 'reload' > /dev/null 2> /dev/null
81 # See how we were called.
96 [ -f /var/lock/subsys/asterisk ] && restart || :
102 echo "Usage: asterisk {start|stop|restart|reload|condrestart|status}"