aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-03-12 06:50:22 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-03-12 06:50:22 +0000
commit8cf288022bfa8c2b0f6137c4cd33f3176a83459e (patch)
treeed3670ecc9a944402ab6d0b7f1737a07f86b1d96 /contrib
parent37112db5b71056b829b8169e27f838644033b4c1 (diff)
Improve mandrake init files (bug #3699)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5174 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/init.d/rc.mandrake.asterisk79
-rwxr-xr-xcontrib/init.d/rc.mandrake.zaptel22
2 files changed, 45 insertions, 56 deletions
diff --git a/contrib/init.d/rc.mandrake.asterisk b/contrib/init.d/rc.mandrake.asterisk
index 49b12d36a..5452fdda7 100755
--- a/contrib/init.d/rc.mandrake.asterisk
+++ b/contrib/init.d/rc.mandrake.asterisk
@@ -15,11 +15,21 @@ CONSOLE=yes # Whether or not you want a console
NOTIFY=root # Who to notify about crashes
DUMPDROP=/tmp
HOSTNAME=`hostname`
+CONFIGFILE=/etc/sysconfig/`basename $0`
# Setup environment
cd /usr/src
-OPENH323DIR=/usr/src/openh323
-PWLIBDIR=/usr/src/pwlib
+if [ -f /usr/lib/asterisk/modules/chan_h323.so -a `grep -c ^noload=chan_h323.so /etc/asterisk/modules.conf` -eq 0 ]; then
+ OPENH323DIR=/usr/src/h323/openh323
+ PWLIBDIR=/usr/src/h323/pwlib
+else
+ OPENH323DIR=/usr/src/oh323/openh323
+ PWLIBDIR=/usr/src/oh323/pwlib
+fi
+
+# Put overrides in /etc/sysconfig/asterisk
+[ -f $CONFIGFILE ] && . $CONFIGFILE
+
LD_LIBRARY_PATH=$OPENH323DIR/lib:$PWLIBDIR/lib
export OPENH323DIR PWLIBDIR LD_LIBRARY_PATH
@@ -58,6 +68,8 @@ ulimit -c unlimited
#{
#}
+SIGMSG=("Hangup" "Interrupt" "Quit" "Illegal instruction" "Trace trap" "IOT Trap" "Bus Error" "Floating-point exception" "Killed" "User-defined signal 1" "Segmentation violation" "User-defined signal 2" "Broken pipe" "Alarm clock" "Termination" "Stack fault")
+
run_asterisk()
{
while :; do
@@ -77,55 +89,8 @@ run_asterisk()
echo "Asterisk shutdown normally."
exit 0
elif [ $EXITSTATUS -gt 128 ]; then
- if [ "$EXITSTATUS" = "129" ]; then
- EXITSIGNAL=1
- EXITMSG="Hangup"
- elif [ "$EXITSTATUS" = "130" ]; then
- EXITSIGNAL=2
- EXITMSG="Interrupt"
- elif [ "$EXITSTATUS" = "131" ]; then
- EXITSIGNAL=3
- EXITMSG="Quit"
- elif [ "$EXITSTATUS" = "132" ]; then
- EXITSIGNAL=4
- EXITMSG="Illegal instruction"
- elif [ "$EXITSTATUS" = "133" ]; then
- EXITSIGNAL=5
- EXITMSG="Trace trap"
- elif [ "$EXITSTATUS" = "134" ]; then
- EXITSIGNAL=6
- EXITMSG="IOT Trap"
- elif [ "$EXITSTATUS" = "135" ]; then
- EXITSIGNAL=7
- EXITMSG="Bus Error"
- elif [ "$EXITSTATUS" = "136" ]; then
- EXITSIGNAL=8
- EXITMSG="Floating-point exception"
- elif [ "$EXITSTATUS" = "137" ]; then
- EXITSIGNAL=9
- EXITMSG="Killed"
- elif [ "$EXITSTATUS" = "138" ]; then
- EXITSIGNAL=10
- EXITMSG="User-defined signal 1"
- elif [ "$EXITSTATUS" = "139" ]; then
- EXITSIGNAL=11
- EXITMSG="Segmentation violation"
- elif [ "$EXITSTATUS" = "140" ]; then
- EXITSIGNAL=12
- EXITMSG="User-defined signal 2"
- elif [ "$EXITSTATUS" = "141" ]; then
- EXITSIGNAL=13
- EXITMSG="Broken pipe"
- elif [ "$EXITSTATUS" = "142" ]; then
- EXITSIGNAL=14
- EXITMSG="Alarm clock"
- elif [ "$EXITSTATUS" = "143" ]; then
- EXITSIGNAL=15
- EXITMSG="Termination"
- elif [ "$EXITSTATUS" = "144" ]; then
- EXITSIGNAL=16
- EXITMSG="Stack fault"
- fi
+ EXITSIGNAL=$(($EXITSTATUS - 128))
+ EXITMSG=$SIGMSG[$EXITSIGNAL]
echo "Asterisk exited on signal $EXITSIGNAL - $EXITMSG."
if [ "$NOTIFY" != "" ]; then
echo "Asterisk exited on signal $EXITSIGNAL - $EXITMSG. Might want to take a peek." | \
@@ -186,6 +151,16 @@ case "$1" in
$0 stopnow
$0 start
;;
+ fullrestart)
+ $0 stop
+ service zaptel restart
+ $0 start
+ ;;
+ fullrestartnow)
+ $0 stopnow
+ service zaptel restart
+ $0 start
+ ;;
status)
succeeded=`pidof asterisk|awk '{print NF}'`
if [ $succeeded = "0" ]; then
@@ -195,7 +170,7 @@ case "$1" in
fi
;;
*)
- gprintf "*** Usage: $0 {start|stop|reload|restart|stopnow|restartnow|status}\n"
+ gprintf "*** Usage: $0 {start|stop[now]|reload|[full]restart[now]|status}\n"
exit 1
esac
diff --git a/contrib/init.d/rc.mandrake.zaptel b/contrib/init.d/rc.mandrake.zaptel
index 26ce46d3f..c5c26000e 100755
--- a/contrib/init.d/rc.mandrake.zaptel
+++ b/contrib/init.d/rc.mandrake.zaptel
@@ -12,15 +12,16 @@
# Source function library.
. /etc/rc.d/init.d/functions
-######################################
-# CONFIGURE ME !!!
+# Default modules - override in /etc/sysconfig/zaptel
######################################
MODULES="usb-uhci zaptel wcfxo wcusb"
######################################
+[ -f /etc/sysconfig/`basename $0` ] && . /etc/sysconfig/`basename $0`
+
function probe() {
gprintf " $1"
- insmod $1
+ modprobe -i $1
# It has to be in the module list, otherwise something is wrong
if lsmod | grep -c ^$1 >/dev/null; then
success
@@ -69,7 +70,20 @@ case "$1" in
done
;;
status)
- ztcfg -vv
+ #ztcfg -vv
+ OK=1
+ gprintf "Checking Asterisk modules"
+ for i in $MODULES; do
+ if [ `lsmod | grep -c $i` -eq 0 ]; then
+ OK=0
+ fi
+ done
+ if [ $OK -gt 0 ]; then
+ success
+ else
+ failure
+ fi
+ echo
;;
restart)
$0 stop