![mvanbaak](/assets/img/avatar_default.png)
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r119301 | mvanbaak | 2008-05-30 18:44:39 +0200 (Fri, 30 May 2008) | 14 lines dont use a bashism way to check the $VERSION variable. The rc/init.d scripts, and safe_asterisk work on normal sh now again. Tested on: OpenBSD 4.2 (me) Debian etch (me) Ubuntu Hardy (me and loloski) FC9 (loloski) (closes issue #12687) Reported by: loloski Patches: 20080529-12687-safe_asterisk-fixversion.diff.txt uploaded by mvanbaak (license 7) Tested by: loloski, mvanbaak ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@119302 f38db490-d61c-443f-a65b-d21fe96a405b
52 lines
1 KiB
Bash
Executable file
52 lines
1 KiB
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# Start/stop/restart Asterisk PBX
|
|
#
|
|
# Version: 1.0 - Paul Belanger <pabelanger@gmail.com>
|
|
#
|
|
# 03.29.2005 - Initial Version
|
|
#
|
|
# $Id$
|
|
|
|
asterisk_start() {
|
|
if [ -x /usr/sbin/asterisk ]; then
|
|
# Check if Asterisk is already running. If it is, then bug out, because
|
|
# starting safe_asterisk when Asterisk is running is very bad.
|
|
VERSION=`/usr/sbin/asterisk -rx 'core show version'`
|
|
if [ "`echo $VERSION | cut -c 1-8`" = "Asterisk" ]; then
|
|
echo "Asterisk is already running. $0 will exit now."
|
|
exit 1
|
|
fi
|
|
|
|
echo "Starting Asterisk /usr/sbin/asterisk"
|
|
/usr/sbin/asterisk
|
|
fi
|
|
}
|
|
|
|
asterisk_stop() {
|
|
# If there is no PID file, ignore this request...
|
|
if [ -r /var/run/asterisk.pid ]; then
|
|
killall asterisk
|
|
fi
|
|
}
|
|
|
|
asterisk_restart() {
|
|
asterisk_stop
|
|
asterisk_start
|
|
}
|
|
|
|
case "$1" in
|
|
'start')
|
|
asterisk_start
|
|
;;
|
|
'stop')
|
|
asterisk_stop
|
|
;;
|
|
'restart')
|
|
asterisk_restart
|
|
;;
|
|
*)
|
|
echo "usage $0 start|stop|restart" ;;
|
|
esac
|
|
|