2 # $Id: asterisk,v 1.2 2004/07/18 20:24:07 Gregory Boehnlein <damin@nacs.net>
4 # asterisk start the asterisk PBX
6 # Sun Jul 18 2004 Gregory Boehnlein <damin@nacs.net>
7 # - Updated Version to 1.2
8 # - Added test for safe_asterisk
9 # - Changed "stop gracefully" to "stop now"
10 # - Added support for -U and -G command line options
11 # - Modified "reload" to call asterisk -rx 'reload'
13 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
16 # Full path to asterisk binary
17 DAEMON=/usr/sbin/asterisk
19 # Full path to safe_asterisk script
20 SAFE_ASTERISK=/usr/sbin/safe_asterisk
22 # Leave this set unless you know what you are doing.
23 export LD_ASSUME_KERNEL=2.4.1
25 # Uncomment the following and set them to the user/groups that you
26 # want to run Asterisk as. NOTE: this requires substantial work to
27 # be sure that Asterisk's environment has permission to write the
28 # files required for its operation, including logs, its comm
29 # socket, the asterisk database, etc.
33 test -x $DAEMON || exit 0
39 echo -n "Starting $DESC: "
40 if [ -f $SAFE_ASTERISK ] ; then
43 if [ $AST_USER ] ; then
44 ASTARGS="-U $AST_USER"
46 if [ $AST_GROUP ] ; then
47 ASTARGS="`echo $ASTARGS` -G $AST_GROUP"
49 start-stop-daemon --start --exec $DAEMON -- $ASTARGS
53 echo -n "Stopping $DESC: "
54 $DAEMON -rx 'stop now' > /dev/null 2> /dev/null && echo -n "$NAME"
59 echo "Reloading $DESC configuration files."
60 $DAEMON -rx 'reload' > /dev/null 2> /dev/null
63 $DAEMON -rx 'restart gracefully' > /dev/null 2> /dev/null && echo -n "$NAME"
67 echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2