aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/init.d
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-01-11 23:00:55 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-01-11 23:00:55 +0000
commitfdffc0a9b11700572ae771939adeda8a4de8ed5f (patch)
tree8cbac595cfb96c97b174864fedaf1b8a3e6b44f2 /contrib/init.d
parentc196e591cefc168ddc8fabdd7094eaa1e9749eeb (diff)
Permit more options in the Makefile as to startup options
(closes issue #16454) Reported by: syspert Patches: 20091228__issue16454__3.diff.txt uploaded by tilghman (license 14) Tested by: syspert git-svn-id: http://svn.digium.com/svn/asterisk/trunk@239231 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'contrib/init.d')
-rwxr-xr-xcontrib/init.d/rc.debian.asterisk47
-rwxr-xr-xcontrib/init.d/rc.mandriva.asterisk2
-rwxr-xr-xcontrib/init.d/rc.redhat.asterisk42
-rwxr-xr-xcontrib/init.d/rc.suse.asterisk39
4 files changed, 100 insertions, 30 deletions
diff --git a/contrib/init.d/rc.debian.asterisk b/contrib/init.d/rc.debian.asterisk
index 045a8ceef..22f6f974e 100755
--- a/contrib/init.d/rc.debian.asterisk
+++ b/contrib/init.d/rc.debian.asterisk
@@ -38,21 +38,6 @@ TRUE=/bin/true
# Description: the Asterisk Open Source PBX
### END INIT INFO
-# Uncomment this ONLY if you know what you are doing.
-# export LD_ASSUME_KERNEL=2.4.1
-
-# 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"
-
-# If you DON'T want Asterisk to start up with terminal colors, comment
-# this out.
-COLOR=yes
-
set -e
if ! [ -x $DAEMON ] ; then
@@ -68,6 +53,15 @@ fi
# Use the LSB standar functions for services management
. /lib/lsb/init-functions
+# Allow configuration overrides in /etc/default/asterisk
+CONFIG0=`readlink $0`
+if [ "$CONFIG0" = "" ]; then
+ CONFIGFILE=/etc/default/`basename $0`
+else
+ CONFIGFILE=/etc/default/`basename $CONFIG0`
+fi
+[ -r $CONFIGFILE ] && . $CONFIGFILE
+
case "$1" in
start)
# Check if Asterisk is already running. If it is, then bug out, because
@@ -91,6 +85,29 @@ case "$1" in
ASTARGS="$ASTARGS -G $AST_GROUP"
chgrp $AST_GROUP $ASTVARRUNDIR
fi
+ if [ $ALTCONF ]; then
+ ASTARGS="$ASTARGS -C \"$ALTCONF\""
+ fi
+ if [ "x$COREDUMP" = "xyes" ]; then
+ ASTARGS="$ASTARGS -g"
+ fi
+ if [ "0$MAXLOAD" -gt "0" ]; then
+ ASTARGS="$ASTARGS -L $MAXLOAD"
+ fi
+ if [ "0$MAXCALLS" -gt "0" ]; then
+ ASTARGS="$ASTARGS -M $MAXCALLS"
+ fi
+ if [ "0$VERBOSITY" -gt "0" ]; then
+ for i in `seq 1 $VERBOSITY`; do
+ ASTARGS="$ASTARGS -v"
+ done
+ fi
+ if [ "x$INTERNALTIMING" = "xyes" ]; then
+ ASTARGS="$ASTARGS -I"
+ fi
+ if [ "x$TEMPRECORDINGLOCATION" = "xyes" -o "x$TMPRECORDINGLOCATION" = "xyes" ]; then
+ ASTARGS="$ASTARGS -t"
+ fi
# "start-stop-daemon --oknodo" returns 0 even if Asterisk was already running (as LSB expects):
if test "x$COLOR" = "xyes" ; then
export TERM=linux
diff --git a/contrib/init.d/rc.mandriva.asterisk b/contrib/init.d/rc.mandriva.asterisk
index 1e036f0c8..48cd4c565 100755
--- a/contrib/init.d/rc.mandriva.asterisk
+++ b/contrib/init.d/rc.mandriva.asterisk
@@ -37,7 +37,7 @@ else
fi
# Put overrides in /etc/sysconfig/asterisk
-[ -f $CONFIGFILE ] && . $CONFIGFILE
+[ -r $CONFIGFILE ] && . $CONFIGFILE
LD_LIBRARY_PATH=$OPENH323DIR/lib:$PWLIBDIR/lib
export OPENH323DIR PWLIBDIR LD_LIBRARY_PATH
diff --git a/contrib/init.d/rc.redhat.asterisk b/contrib/init.d/rc.redhat.asterisk
index 5391c7b0f..df61e7746 100755
--- a/contrib/init.d/rc.redhat.asterisk
+++ b/contrib/init.d/rc.redhat.asterisk
@@ -26,14 +26,6 @@
# 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
@@ -47,9 +39,6 @@ if ! [ -d $AST_CONFIG ] ; then
exit 0
fi
-# Uncomment this ONLY if you know what you are doing.
-# export LD_ASSUME_KERNEL=2.4.1
-
# Full path to asterisk binary
DAEMON=$AST_SBIN/asterisk
@@ -63,7 +52,7 @@ if [ "$CONFIG0" = "" ]; then
else
CONFIGFILE=/etc/sysconfig/`basename $CONFIG0`
fi
-[ -x $CONFIGFILE ] && . $CONFIGFILE
+[ -r $CONFIGFILE ] && . $CONFIGFILE
RETVAL=0
@@ -89,8 +78,35 @@ start() {
fi
if [ $AST_CONFIG ]; then
ASTARGS="$ASTARGS -C $AST_CONFIG/asterisk.conf"
+ elif [ $ALTCONF ]; then
+ ASTARGS="$ASTARGS -C $ALTCONF"
+ fi
+ if [ "x$COREDUMP" = "xyes" ]; then
+ ASTARGS="$ASTARGS -g"
+ fi
+ if [ "0$MAXLOAD" -gt "0" ]; then
+ ASTARGS="$ASTARGS -L $MAXLOAD"
+ fi
+ if [ "0$MAXCALLS" -gt "0" ]; then
+ ASTARGS="$ASTARGS -M $MAXCALLS"
+ fi
+ if [ "0$VERBOSITY" -gt "0" ]; then
+ for i in `seq 1 $VERBOSITY`; do
+ ASTARGS="$ASTARGS -v"
+ done
+ fi
+ if [ "x$INTERNALTIMING" = "xyes" ]; then
+ ASTARGS="$ASTARGS -I"
+ fi
+ if [ "x$TEMPRECORDINGLOCATION" = "xyes" -o "x$TMPRECORDINGLOCATION" = "xyes" ]; then
+ ASTARGS="$ASTARGS -t"
+ fi
+ if [ "x$COLOR" = "xyes" ]; then
+ export TERM=linux
+ daemon sh -c "$DAEMON $ASTARGS -c" >/dev/null </dev/null 2>&1 &
+ else
+ daemon $DAEMON $ASTARGS
fi
- daemon $DAEMON $ASTARGS
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/asterisk
echo
diff --git a/contrib/init.d/rc.suse.asterisk b/contrib/init.d/rc.suse.asterisk
index 54b67207a..e4976bb61 100755
--- a/contrib/init.d/rc.suse.asterisk
+++ b/contrib/init.d/rc.suse.asterisk
@@ -59,6 +59,15 @@ SAFE_ASTERISK=/usr/sbin/safe_asterisk
#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
+[ -r $CONFIGFILE ] && . $CONFIGFILE
+
RETVAL=0
start() {
@@ -82,7 +91,35 @@ start() {
if [ $AST_GROUP ] ; then
ASTARGS="`echo $ASTARGS` -G $AST_GROUP"
fi
- $DAEMON $ASTARGS
+ if [ $ALTCONF ]; then
+ ASTARGS="$ASTARGS -C $ALTCONF"
+ fi
+ if [ "x$COREDUMP" = "xyes" ]; then
+ ASTARGS="$ASTARGS -g"
+ fi
+ if [ "0$MAXLOAD" -gt "0" ]; then
+ ASTARGS="$ASTARGS -L $MAXLOAD"
+ fi
+ if [ "0$MAXCALLS" -gt "0" ]; then
+ ASTARGS="$ASTARGS -M $MAXCALLS"
+ fi
+ if [ "$VERBOSITY" -gt "0" ]; then
+ for i in `seq 1 $VERBOSITY`; do
+ ASTARGS="$ASTARGS -v"
+ done
+ fi
+ if [ "x$INTERNALTIMING" = "xyes" ]; then
+ ASTARGS="$ASTARGS -I"
+ fi
+ if [ "x$TEMPRECORDINGLOCATION" = "xyes" -o "x$TMPRECORDINGLOCATION" = "xyes" ]; then
+ ASTARGS="$ASTARGS -t"
+ fi
+ if [ "x$COLOR" = "xyes" ]; then
+ export TERM=linux
+ sh -c "$DAEMON $ASTARGS -c" >/dev/null </dev/null 2>&1 &
+ else
+ $DAEMON $ASTARGS
+ fi
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/asterisk
echo