[asterisk-commits] trunk r14869 - in /trunk: ./ contrib/init.d/rc.redhat.asterisk

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Mar 24 22:10:08 MST 2006


Author: tilghman
Date: Fri Mar 24 23:10:07 2006
New Revision: 14869

URL: http://svn.digium.com/view/asterisk?rev=14869&view=rev
Log:
Merged revisions 14868 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r14868 | tilghman | 2006-03-24 23:07:52 -0600 (Fri, 24 Mar 2006) | 2 lines

Bug 6601 - More configuration abilities for the RH init script

........

Modified:
    trunk/   (props changed)
    trunk/contrib/init.d/rc.redhat.asterisk

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Modified: trunk/contrib/init.d/rc.redhat.asterisk
URL: http://svn.digium.com/view/asterisk/trunk/contrib/init.d/rc.redhat.asterisk?rev=14869&r1=14868&r2=14869&view=diff
==============================================================================
--- trunk/contrib/init.d/rc.redhat.asterisk (original)
+++ trunk/contrib/init.d/rc.redhat.asterisk Fri Mar 24 23:10:07 2006
@@ -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 @@
 # 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 @@
 		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=$?



More information about the asterisk-commits mailing list