mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-05-07 05:04:25 +02:00
41 lines
1.2 KiB
Bash
41 lines
1.2 KiB
Bash
#!/sbin/openrc-run
|
|
# Copyright 1999-2008 Gentoo Foundation
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
# $Header: /var/www/viewcvs.gentoo.org/raw_cvs/gentoo-x86/net-misc/iaxmodem/files/iaxmodem.initd,v 1.1 2008/10/14 23:53:39 sbriesen Exp $
|
|
|
|
command="/usr/sbin/iaxmodem"
|
|
pidfile="/var/run/${SVCNAME}.pid"
|
|
name="iaxmodem"
|
|
|
|
depend() {
|
|
use asterisk
|
|
need net
|
|
after firewall
|
|
}
|
|
|
|
start() {
|
|
ebegin "Starting ${SVCNAME}"
|
|
start-stop-daemon --start --quiet --pidfile "${pidfile}" \
|
|
--env TMPDIR="/tmp" --nice ${IAXMODEM_NICE:-0} --exec "${command}" -- ${IAXMODEM_OPTS}
|
|
eend ${?}
|
|
}
|
|
|
|
stop() {
|
|
local childs=""
|
|
ebegin "Stopping ${SVCNAME}"
|
|
# start-stop-daemon doesn't kill childs reliable, so we
|
|
# use a combination of pgrep + start-stop-daemon + kill
|
|
[ -s "${pidfile}" ] && childs=$(pgrep -P $(cat "${pidfile}"))
|
|
start-stop-daemon --stop --quiet --pidfile "${pidfile}" --retry TERM/10/KILL/5
|
|
if eend ${?}; then
|
|
# if there're still childs running, kill them!
|
|
[ -n "${childs}" ] && kill -KILL ${childs} 2>/dev/null
|
|
return 0
|
|
fi
|
|
}
|
|
|
|
reload() {
|
|
ebegin "Reloading ${SVCNAME} configuration"
|
|
start-stop-daemon --stop --signal HUP --pidfile "${pidfile}"
|
|
eend ${?}
|
|
}
|