You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/net-p2p/automatic/files/automatic.initd

36 lines
745 B

#!/sbin/openrc-run
NAME=${SVCNAME##*.}
if [ -n "${NAME}" -a "${SVCNAME}" != "automatic" ]; then
PID="/run/automatic.${NAME}.pid"
PNAME=$(echo ${RC_SVCNAME} | sed 's/\..*//g')
CONF_DEFAULT="/etc/conf.d/automatic.${NAME}"
else
PID="/run/automatic.pid"
PNAME=${RC_SVCNAME}
CONF_DEFAULT="/etc/conf.d/automatic"
fi
CONF=${CONF:-${CONF_DEFAULT}}
EXEC=${EXEC:-/usr/bin/automatic}
depend() {
need net
}
start() {
ebegin "Starting automatic"
start-stop-daemon --start --quiet --make-pidfile --pidfile ${PID} --exec ${EXEC} -- ${OPTS} ${CONFIG}
eend $?
}
start_post() {
pgrep -n $(echo ${PNAME}) > ${PID}
}
stop() {
ebegin "Stopping automatic"
start-stop-daemon --stop --quiet --pidfile ${PID}
rm -f ${PID}
eend $?
}