diff options
Diffstat (limited to 'net-p2p/automatic/files/automatic.initd')
-rw-r--r-- | net-p2p/automatic/files/automatic.initd | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/net-p2p/automatic/files/automatic.initd b/net-p2p/automatic/files/automatic.initd new file mode 100644 index 000000000000..a5c6189b56b1 --- /dev/null +++ b/net-p2p/automatic/files/automatic.initd @@ -0,0 +1,36 @@ +#!/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 + provide automatic +} + +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 $? +} |