summaryrefslogtreecommitdiff
path: root/pcr/miniupnpd/miniupnpd.init
diff options
context:
space:
mode:
authorMichał Masłowski <mtjm@mtjm.eu>2013-02-16 12:28:33 +0100
committerMichał Masłowski <mtjm@mtjm.eu>2013-02-16 12:28:33 +0100
commit708526fe67ec9cd87f7a5965d515971d6faf8884 (patch)
tree80158cf8e6b69852e974777db3e3d6822690542c /pcr/miniupnpd/miniupnpd.init
parent80ba9b9d983a8bfa0ea3be8a5841eb88d919d603 (diff)
parent4a4f6be8604aa35bdc81ae29d86b07dc8aea0c5c (diff)
Merge branch 'master' of ssh://parabolagnulinux.org:1863/home/parabola/abslibre-pre-mips64el
Conflicts: community/jhead/PKGBUILD extra/qca-gnupg/PKGBUILD extra/qca-ossl/PKGBUILD extra/qca/PKGBUILD
Diffstat (limited to 'pcr/miniupnpd/miniupnpd.init')
-rw-r--r--pcr/miniupnpd/miniupnpd.init51
1 files changed, 51 insertions, 0 deletions
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