aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorroot <root@f38db490-d61c-443f-a65b-d21fe96a405b>2006-03-25 06:07:49 +0000
committerroot <root@f38db490-d61c-443f-a65b-d21fe96a405b>2006-03-25 06:07:49 +0000
commitffa0c30f51510b3df73851214e157bf7ce452a8c (patch)
treefd07664af1e9f161dfa55792cc424adeab659b20 /contrib
parent539b5a265c40a035ce5f257dfe09f4fc7d766aa5 (diff)
automerge commit
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2-netsec@14914 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/init.d/rc.redhat.asterisk42
1 files changed, 30 insertions, 12 deletions
diff --git a/contrib/init.d/rc.redhat.asterisk b/contrib/init.d/rc.redhat.asterisk
index 1ef812463..615ec2746 100755
--- a/contrib/init.d/rc.redhat.asterisk
+++ b/contrib/init.d/rc.redhat.asterisk
@@ -20,15 +20,29 @@
# - Added support for -U and -G command line options
# - Modified "reload" to call asterisk -rx 'reload'
+# Use this option to specify a different configuration directory
+#AST_CONFIG=/etc/asterisk
+
+# Installation directory
+AST_SBIN=/usr/sbin
+
+# Uncomment the following and set them to the user/groups that you
+# want to run Asterisk as. NOTE: this requires substantial work to
+# be sure that Asterisk's environment has permission to write the
+# files required for its operation, including logs, its comm
+# socket, the asterisk database, etc.
+#AST_USER="asterisk"
+#AST_GROUP="asterisk"
+
# Source function library.
. /etc/rc.d/init.d/functions
-if ! [ -x /usr/sbin/asterisk ] ; then
+if ! [ -x $AST_SBIN/asterisk ] ; then
echo "ERROR: /usr/sbin/asterisk not found"
exit 0
fi
-if ! [ -d /etc/asterisk ] ; then
+if ! [ -d $AST_CONFIG ] ; then
echo "ERROR: /etc/asterisk directory not found"
exit 0
fi
@@ -37,18 +51,19 @@ fi
# export LD_ASSUME_KERNEL=2.4.1
# Full path to asterisk binary
-DAEMON=/usr/sbin/asterisk
+DAEMON=$AST_SBIN/asterisk
# Full path to safe_asterisk script
-SAFE_ASTERISK=/usr/sbin/safe_asterisk
+SAFE_ASTERISK=$AST_SBIN/safe_asterisk
-# Uncomment the following and set them to the user/groups that you
-# want to run Asterisk as. NOTE: this requires substantial work to
-# be sure that Asterisk's environment has permission to write the
-# files required for its operation, including logs, its comm
-# socket, the asterisk database, etc.
-#AST_USER="asterisk"
-#AST_GROUP="asterisk"
+# Allow configuration overrides in /etc/sysconfig/asterisk
+CONFIG0=`readlink $0`
+if [ $CONFIG0 = "" ]; then
+ CONFIGFILE=/etc/sysconfig/`basename $0`
+else
+ CONFIGFILE=/etc/sysconfig/`basename $CONFIG0`
+fi
+[ -x $CONFIGFILE ] && . $CONFIGFILE
RETVAL=0
@@ -62,7 +77,10 @@ start() {
ASTARGS="-U $AST_USER"
fi
if [ $AST_GROUP ] ; then
- ASTARGS="`echo $ASTARGS` -G $AST_GROUP"
+ ASTARGS="$ASTARGS -G $AST_GROUP"
+ fi
+ if [ $AST_CONFIG ]; then
+ ASTARGS="$ASTARGS -C $AST_CONFIG"
fi
daemon $DAEMON $ASTARGS
RETVAL=$?