From 0174f5578fd28a78c48e99e1730fdae27c0fdb1b Mon Sep 17 00:00:00 2001 From: Omar Vega Ramos Date: Sat, 16 Feb 2013 00:18:10 -0500 Subject: Adding packages to pcr --- pcr/miniupnpd/miniupnpd.init | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 pcr/miniupnpd/miniupnpd.init (limited to 'pcr/miniupnpd/miniupnpd.init') diff --git a/pcr/miniupnpd/miniupnpd.init b/pcr/miniupnpd/miniupnpd.init new file mode 100644 index 000000000..e09ac3ade --- /dev/null +++ b/pcr/miniupnpd/miniupnpd.init @@ -0,0 +1,51 @@ +#!/bin/sh + +MINIUPNPD=/usr/sbin/miniupnpd +ARGS='-f /etc/miniupnpd/miniupnpd.conf' +PIDFILE='/var/run/miniupnpd.pid' +IPTABLES_CREATE=/etc/miniupnpd/iptables_init.sh +IPTABLES_REMOVE=/etc/miniupnpd/iptables_removeall.sh + +. /etc/rc.d/functions + +case "$1" in + start) + stat_busy "Starting MiniUPNPd" + + if ! pidof -o %PPID $MINIUPNPD &> /dev/null; then + rm -f "$PIDFILE" + fi + + $IPTABLES_CREATE > /dev/null 2>&1 + + PID="$(cat "$PIDFILE" 2> /dev/null)" + + if [ -z "$PID" ] && $MINIUPNPD $ARGS; then + add_daemon miniupnpd + stat_done + else + stat_fail + fi + ;; + stop) + stat_busy "Stopping MiniUPNPd" + PID="$(cat "$PIDFILE" 2> /dev/null)" + if [ -n "$PID" ] && kill "$PID" &> /dev/null; then + rm -f "$PIDFILE" + rm_daemon miniupnpd + stat_done + else + stat_fail + fi + ;; + restart) + "$0" stop + sleep 1 + "$0" start + ;; + *) + echo "Usage: /etc/rc.d/miniupnpd {start|stop|restart}" + exit 2 + ;; +esac +exit 0 -- cgit v1.2.3