|
|
0cbcf0d |
Index: contrib/init.d/rc.redhat.asterisk
|
|
|
0cbcf0d |
===================================================================
|
|
|
4e74e55 |
--- contrib/init.d/rc.redhat.asterisk (revision 228657)
|
|
|
0cbcf0d |
+++ contrib/init.d/rc.redhat.asterisk (working copy)
|
|
|
729de3c |
@@ -3,7 +3,7 @@
|
|
|
729de3c |
#
|
|
|
729de3c |
# asterisk Starts, Stops and Reloads Asterisk.
|
|
|
729de3c |
#
|
|
|
729de3c |
-# chkconfig: 2345 90 60
|
|
|
729de3c |
+# chkconfig: - 90 60
|
|
|
729de3c |
# description: Asterisk PBX and telephony daemon.
|
|
|
729de3c |
# processname: asterisk
|
|
|
729de3c |
# pidfile: /var/run/asterisk.pid
|
|
|
c5b498c |
@@ -20,51 +20,51 @@
|
|
|
729de3c |
# - Added support for -U and -G command line options
|
|
|
729de3c |
# - Modified "reload" to call asterisk -rx 'reload'
|
|
|
729de3c |
|
|
|
729de3c |
-# Use this option to specify a different configuration directory
|
|
|
729de3c |
-#AST_CONFIG=/etc/asterisk
|
|
|
729de3c |
+# Do not modify this script to change any of the settings, instead
|
|
|
729de3c |
+# edit /etc/sysconfig/asterisk
|
|
|
0cbcf0d |
|
|
|
729de3c |
+# Specify the configuration file
|
|
|
729de3c |
+AST_CONFIG=/etc/asterisk/asterisk.conf
|
|
|
0cbcf0d |
+
|
|
|
729de3c |
# Installation directory
|
|
|
729de3c |
AST_SBIN=/usr/sbin
|
|
|
729de3c |
|
|
|
729de3c |
-# Uncomment the following and set them to the user/groups that you
|
|
|
729de3c |
-# want to run Asterisk as. NOTE: this requires substantial work to
|
|
|
729de3c |
-# be sure that Asterisk's environment has permission to write the
|
|
|
729de3c |
-# files required for its operation, including logs, its comm
|
|
|
729de3c |
-# socket, the asterisk database, etc.
|
|
|
729de3c |
-#AST_USER="asterisk"
|
|
|
d87117a |
+# The user that Asterisk will run as.
|
|
|
729de3c |
+AST_USER="asterisk"
|
|
|
d87117a |
+
|
|
|
d87117a |
+# If a user is specified above, Asterisk will change the group it runs
|
|
|
d87117a |
+# as to the primary group of the user, as well as initialize the
|
|
|
d87117a |
+# supplementary groups. If you want to run Asterisk as a different
|
|
|
d87117a |
+# group, set AST_GROUP to the group that Asterisk should run as. Note
|
|
|
0cbcf0d |
+# that this may break DAHDI devices as supplementary groups will not
|
|
|
d87117a |
+# be initialized.
|
|
|
d87117a |
#AST_GROUP="asterisk"
|
|
|
729de3c |
|
|
|
729de3c |
-# Source function library.
|
|
|
729de3c |
-. /etc/rc.d/init.d/functions
|
|
|
729de3c |
+# Allow configuration overrides in /etc/sysconfig/asterisk
|
|
|
729de3c |
+CONFIG0=`readlink $0`
|
|
|
729de3c |
+if [ "$CONFIG0" = "" ]; then
|
|
|
729de3c |
+ CONFIGFILE=/etc/sysconfig/`basename $0`
|
|
|
729de3c |
+else
|
|
|
729de3c |
+ CONFIGFILE=/etc/sysconfig/`basename $CONFIG0`
|
|
|
729de3c |
+fi
|
|
|
729de3c |
+[ -f $CONFIGFILE ] && . $CONFIGFILE
|
|
|
729de3c |
|
|
|
729de3c |
if ! [ -x $AST_SBIN/asterisk ] ; then
|
|
|
729de3c |
echo "ERROR: $AST_SBIN/asterisk not found"
|
|
|
729de3c |
exit 0
|
|
|
729de3c |
fi
|
|
|
729de3c |
|
|
|
729de3c |
-if ! [ -d $AST_CONFIG ] ; then
|
|
|
729de3c |
- echo "ERROR: $AST_CONFIG directory not found"
|
|
|
729de3c |
+if ! [ -f $AST_CONFIG ] ; then
|
|
|
729de3c |
+ echo "ERROR: $AST_CONFIG not found"
|
|
|
729de3c |
exit 0
|
|
|
729de3c |
fi
|
|
|
729de3c |
|
|
|
729de3c |
-# Uncomment this ONLY if you know what you are doing.
|
|
|
729de3c |
-# export LD_ASSUME_KERNEL=2.4.1
|
|
|
729de3c |
+# Source function library.
|
|
|
729de3c |
+. /etc/rc.d/init.d/functions
|
|
|
729de3c |
|
|
|
729de3c |
# Full path to asterisk binary
|
|
|
729de3c |
DAEMON=$AST_SBIN/asterisk
|
|
|
729de3c |
|
|
|
729de3c |
-# Full path to safe_asterisk script
|
|
|
729de3c |
-SAFE_ASTERISK=$AST_SBIN/safe_asterisk
|
|
|
729de3c |
-
|
|
|
729de3c |
-# Allow configuration overrides in /etc/sysconfig/asterisk
|
|
|
729de3c |
-CONFIG0=`readlink $0`
|
|
|
729de3c |
-if [ "$CONFIG0" = "" ]; then
|
|
|
729de3c |
- CONFIGFILE=/etc/sysconfig/`basename $0`
|
|
|
729de3c |
-else
|
|
|
729de3c |
- CONFIGFILE=/etc/sysconfig/`basename $CONFIG0`
|
|
|
729de3c |
-fi
|
|
|
729de3c |
-[ -x $CONFIGFILE ] && . $CONFIGFILE
|
|
|
729de3c |
-
|
|
|
729de3c |
RETVAL=0
|
|
|
729de3c |
|
|
|
729de3c |
start() {
|
|
|
382618c |
@@ -78,19 +78,18 @@
|
|
|
c5b498c |
|
|
|
729de3c |
# Start daemons.
|
|
|
729de3c |
echo -n $"Starting asterisk: "
|
|
|
729de3c |
- if [ -f $SAFE_ASTERISK ] ; then
|
|
|
729de3c |
- DAEMON=$SAFE_ASTERISK
|
|
|
729de3c |
- fi
|
|
|
729de3c |
if [ $AST_USER ] ; then
|
|
|
0cbcf0d |
- ASTARGS="-U $AST_USER"
|
|
|
0cbcf0d |
+ AST_ARGS="-U $AST_USER"
|
|
|
729de3c |
fi
|
|
|
0cbcf0d |
if [ $AST_GROUP ] ; then
|
|
|
0cbcf0d |
- ASTARGS="$ASTARGS -G $AST_GROUP"
|
|
|
0cbcf0d |
+ AST_ARGS="$AST_ARGS -G $AST_GROUP"
|
|
|
673e40b |
fi
|
|
|
673e40b |
if [ $AST_CONFIG ]; then
|
|
|
673e40b |
- ASTARGS="$ASTARGS -C $AST_CONFIG/asterisk.conf"
|
|
|
0cbcf0d |
+ AST_ARGS="$AST_ARGS -C $AST_CONFIG"
|
|
|
673e40b |
fi
|
|
|
0cbcf0d |
- daemon $DAEMON $ASTARGS
|
|
|
382618c |
+ export HOME=~asterisk
|
|
|
382618c |
+ cd $HOME
|
|
|
0cbcf0d |
+ daemon $DAEMON $AST_ARGS $AST_EXTRA_ARGS
|
|
|
673e40b |
RETVAL=$?
|
|
|
0cbcf0d |
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/asterisk
|
|
|
0cbcf0d |
echo
|
|
|
4e74e55 |
@@ -98,14 +96,8 @@
|
|
|
4e74e55 |
}
|
|
|
729de3c |
|
|
|
729de3c |
stop() {
|
|
|
4e74e55 |
- # Stop daemons.
|
|
|
4e74e55 |
- if [ -f $SAFE_ASTERISK ]; then
|
|
|
4e74e55 |
- # Kill safe_asterisk first, to prevent us from starting up 2 instances of safe_asterisk
|
|
|
4e74e55 |
- echo -n $"Stopping safe_asterisk: "
|
|
|
4e74e55 |
- killproc `basename $SAFE_ASTERISK`
|
|
|
4e74e55 |
- echo
|
|
|
4e74e55 |
- fi
|
|
|
729de3c |
- echo -n $"Shutting down asterisk: "
|
|
|
4e74e55 |
+ # Stop daemon.
|
|
|
729de3c |
+ echo -n $"Stopping asterisk: "
|
|
|
4e74e55 |
killproc `basename $DAEMON`
|
|
|
729de3c |
RETVAL=$?
|
|
|
729de3c |
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/asterisk
|
|
|
0cbcf0d |
Index: contrib/sysconfig/asterisk
|
|
|
0cbcf0d |
===================================================================
|
|
|
0cbcf0d |
--- contrib/sysconfig/asterisk (revision 225759)
|
|
|
0cbcf0d |
+++ contrib/sysconfig/asterisk (working copy)
|
|
|
0cbcf0d |
@@ -0,0 +1,19 @@
|
|
|
729de3c |
+# Specify the configuration file
|
|
|
729de3c |
+AST_CONFIG=/etc/asterisk/asterisk.conf
|
|
|
729de3c |
+
|
|
|
729de3c |
+# Installation directory
|
|
|
729de3c |
+AST_SBIN=/usr/sbin
|
|
|
729de3c |
+
|
|
|
d87117a |
+# The user that Asterisk will run as.
|
|
|
729de3c |
+AST_USER="asterisk"
|
|
|
d87117a |
+
|
|
|
d87117a |
+# If a user is specified above, Asterisk will change the group it runs
|
|
|
d87117a |
+# as to the primary group of the user, as well as initialize the
|
|
|
d87117a |
+# supplementary groups. If you want to run Asterisk as a different
|
|
|
d87117a |
+# group, set AST_GROUP to the group that Asterisk should run as. Note
|
|
|
d87117a |
+# that this may break Zaptel devices as supplementary groups will not
|
|
|
d87117a |
+# be initialized.
|
|
|
d87117a |
+#AST_GROUP="asterisk"
|
|
|
0cbcf0d |
+
|
|
|
0cbcf0d |
+# A place to specify extra arguments for the Asterisk command line
|
|
|
0cbcf0d |
+AST_EXTRA_ARGS=""
|