mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Improve mandrake init files (bug #3699)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5174 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -15,11 +15,21 @@ CONSOLE=yes # Whether or not you want a console
|
|||||||
NOTIFY=root # Who to notify about crashes
|
NOTIFY=root # Who to notify about crashes
|
||||||
DUMPDROP=/tmp
|
DUMPDROP=/tmp
|
||||||
HOSTNAME=`hostname`
|
HOSTNAME=`hostname`
|
||||||
|
CONFIGFILE=/etc/sysconfig/`basename $0`
|
||||||
|
|
||||||
# Setup environment
|
# Setup environment
|
||||||
cd /usr/src
|
cd /usr/src
|
||||||
OPENH323DIR=/usr/src/openh323
|
if [ -f /usr/lib/asterisk/modules/chan_h323.so -a `grep -c ^noload=chan_h323.so /etc/asterisk/modules.conf` -eq 0 ]; then
|
||||||
PWLIBDIR=/usr/src/pwlib
|
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
|
LD_LIBRARY_PATH=$OPENH323DIR/lib:$PWLIBDIR/lib
|
||||||
export OPENH323DIR PWLIBDIR LD_LIBRARY_PATH
|
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()
|
run_asterisk()
|
||||||
{
|
{
|
||||||
while :; do
|
while :; do
|
||||||
@@ -77,55 +89,8 @@ run_asterisk()
|
|||||||
echo "Asterisk shutdown normally."
|
echo "Asterisk shutdown normally."
|
||||||
exit 0
|
exit 0
|
||||||
elif [ $EXITSTATUS -gt 128 ]; then
|
elif [ $EXITSTATUS -gt 128 ]; then
|
||||||
if [ "$EXITSTATUS" = "129" ]; then
|
EXITSIGNAL=$(($EXITSTATUS - 128))
|
||||||
EXITSIGNAL=1
|
EXITMSG=$SIGMSG[$EXITSIGNAL]
|
||||||
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
|
|
||||||
echo "Asterisk exited on signal $EXITSIGNAL - $EXITMSG."
|
echo "Asterisk exited on signal $EXITSIGNAL - $EXITMSG."
|
||||||
if [ "$NOTIFY" != "" ]; then
|
if [ "$NOTIFY" != "" ]; then
|
||||||
echo "Asterisk exited on signal $EXITSIGNAL - $EXITMSG. Might want to take a peek." | \
|
echo "Asterisk exited on signal $EXITSIGNAL - $EXITMSG. Might want to take a peek." | \
|
||||||
@@ -186,6 +151,16 @@ case "$1" in
|
|||||||
$0 stopnow
|
$0 stopnow
|
||||||
$0 start
|
$0 start
|
||||||
;;
|
;;
|
||||||
|
fullrestart)
|
||||||
|
$0 stop
|
||||||
|
service zaptel restart
|
||||||
|
$0 start
|
||||||
|
;;
|
||||||
|
fullrestartnow)
|
||||||
|
$0 stopnow
|
||||||
|
service zaptel restart
|
||||||
|
$0 start
|
||||||
|
;;
|
||||||
status)
|
status)
|
||||||
succeeded=`pidof asterisk|awk '{print NF}'`
|
succeeded=`pidof asterisk|awk '{print NF}'`
|
||||||
if [ $succeeded = "0" ]; then
|
if [ $succeeded = "0" ]; then
|
||||||
@@ -195,7 +170,7 @@ case "$1" in
|
|||||||
fi
|
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
|
exit 1
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@@ -12,15 +12,16 @@
|
|||||||
# Source function library.
|
# Source function library.
|
||||||
. /etc/rc.d/init.d/functions
|
. /etc/rc.d/init.d/functions
|
||||||
|
|
||||||
######################################
|
# Default modules - override in /etc/sysconfig/zaptel
|
||||||
# CONFIGURE ME !!!
|
|
||||||
######################################
|
######################################
|
||||||
MODULES="usb-uhci zaptel wcfxo wcusb"
|
MODULES="usb-uhci zaptel wcfxo wcusb"
|
||||||
######################################
|
######################################
|
||||||
|
|
||||||
|
[ -f /etc/sysconfig/`basename $0` ] && . /etc/sysconfig/`basename $0`
|
||||||
|
|
||||||
function probe() {
|
function probe() {
|
||||||
gprintf " $1"
|
gprintf " $1"
|
||||||
insmod $1
|
modprobe -i $1
|
||||||
# It has to be in the module list, otherwise something is wrong
|
# It has to be in the module list, otherwise something is wrong
|
||||||
if lsmod | grep -c ^$1 >/dev/null; then
|
if lsmod | grep -c ^$1 >/dev/null; then
|
||||||
success
|
success
|
||||||
@@ -69,7 +70,20 @@ case "$1" in
|
|||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
status)
|
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)
|
restart)
|
||||||
$0 stop
|
$0 stop
|
||||||
|
Reference in New Issue
Block a user