Archived
14
0
Fork 0
This repository has been archived on 2022-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
asterisk/contrib/init.d/rc.gentoo.asterisk
mvanbaak 1a981f03f5 Merged revisions 119301 via svnmerge from
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
2008-05-30 16:47:24 +00:00

27 lines
588 B
Text
Executable file

#!/sbin/runscript
# $Id$
depend() {
need net logger
}
start() {
# Check if Asterisk is already running. If it is, then bug out, because
# starting safe_asterisk when Asterisk is running is very bad.
VERSION=`${ASTSBINDIR}/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
ebegin "Starting Asterisk"
/usr/sbin/asterisk
eend $? "Failed to start Asterisk"
}
stop() {
ebegin "Stopping Asterisk"
kill $(cat /var/run/asterisk.pid)
eend $? "Failed to stop Asterisk"
}