packages: asterisk/asterisk.init, asterisk/asterisk.sysconfig - run as aste...

glen glen at pld-linux.org
Wed Dec 30 13:18:55 CET 2009


Author: glen                         Date: Wed Dec 30 12:18:55 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- run as asterisk uid

---- Files affected:
packages/asterisk:
   asterisk.init (1.12 -> 1.13) , asterisk.sysconfig (1.1 -> 1.2) 

---- Diffs:

================================================================
Index: packages/asterisk/asterisk.init
diff -u packages/asterisk/asterisk.init:1.12 packages/asterisk/asterisk.init:1.13
--- packages/asterisk/asterisk.init:1.12	Tue Dec 29 18:00:19 2009
+++ packages/asterisk/asterisk.init	Wed Dec 30 13:18:50 2009
@@ -3,7 +3,7 @@
 # asterix	This shell script takes care of starting and stopping
 #		Asterisk PBX
 #
-# chkconfig:	345 90 25
+# chkconfig:	345 90 10
 #
 # description:	Asterisk is an Open Source PBX and telephony development platform that \ \
 #		can both replace a conventional PBX and act as a platform for \
@@ -11,19 +11,29 @@
 #		content over a telephone similarly to how one can deliver dynamic \
 #		content through a web browser using CGI and a web server.
 #
-# pidfile:	/var/run/asterisk.pid
+# pidfile:	/var/run/asterisk/asterisk.pid
 # config:	/etc/asterisk/asterisk.conf
 
-
-# Sanity check
-[ -f /etc/asterisk/asterisk.conf ] || exit 0
-
 # Source function library
 . /etc/rc.d/init.d/functions
 
 # Get network config
 . /etc/sysconfig/network
 
+# Specify the configuration file
+AST_CONFIG=/etc/asterisk/asterisk.conf
+
+# The user that Asterisk will run as.
+AST_USER="asterisk"
+
+# If a user is specified above, Asterisk will change the group it runs
+# as to the primary group of the user, as well as initialize the
+# supplementary groups.  If you want to run Asterisk as a different
+# group, set AST_GROUP to the group that Asterisk should run as.  Note
+# that this may break DAHDI devices as supplementary groups will not
+# be initialized.
+#AST_GROUP="asterisk"
+
 # Get service config
 [ -f /etc/sysconfig/asterisk ] && . /etc/sysconfig/asterisk
 
@@ -45,7 +55,17 @@
 	fi
 
 	msg_starting "Asterisk"
-	daemon /usr/sbin/asterisk $ASTERISK_OPTS
+	if [ $AST_USER ] ; then
+		AST_ARGS="-U $AST_USER"
+	fi
+	if [ $AST_GROUP ] ; then
+		AST_ARGS="$AST_ARGS -G $AST_GROUP"
+	fi
+	if [ $AST_CONFIG ]; then
+		AST_ARGS="$AST_ARGS -C $AST_CONFIG"
+	fi
+	daemon /usr/sbin/asterisk $AST_ARGS $ASTERISK_OPTS
+
 	RETVAL=$?
 	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/asterisk
 }

================================================================
Index: packages/asterisk/asterisk.sysconfig
diff -u packages/asterisk/asterisk.sysconfig:1.1 packages/asterisk/asterisk.sysconfig:1.2
--- packages/asterisk/asterisk.sysconfig:1.1	Tue May 13 12:53:28 2003
+++ packages/asterisk/asterisk.sysconfig	Wed Dec 30 13:18:50 2009
@@ -3,3 +3,19 @@
 # Try to define nice-level for running asterisk
 SERVICE_RUN_NICE_LEVEL="+5"
 
+# Specify the configuration file
+AST_CONFIG=/etc/asterisk/asterisk.conf
+
+# The user that Asterisk will run as.
+AST_USER="asterisk"
+
+# If a user is specified above, Asterisk will change the group it runs
+# as to the primary group of the user, as well as initialize the
+# supplementary groups.  If you want to run Asterisk as a different
+# group, set AST_GROUP to the group that Asterisk should run as.  Note
+# that this may break Zaptel devices as supplementary groups will not
+# be initialized.
+#AST_GROUP="asterisk"
+
+# A place to specify extra arguments for the Asterisk command line
+ASTERISK_OPTS=""
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/asterisk/asterisk.init?r1=1.12&r2=1.13&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/asterisk/asterisk.sysconfig?r1=1.1&r2=1.2&f=u



More information about the pld-cvs-commit mailing list