2011-09-28 19:13:20 +00:00
|
|
|
#!/bin/sh
|
2022-02-19 22:49:18 +00:00
|
|
|
# $Id: miniupnpd.init.d.script,v 1.4 2022/02/19 22:45:06 nanard Exp $
|
2011-09-28 19:13:20 +00:00
|
|
|
# MiniUPnP project
|
|
|
|
# author: Thomas Bernard
|
2022-02-19 22:49:18 +00:00
|
|
|
# website: http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
|
2011-09-28 19:13:20 +00:00
|
|
|
|
2012-03-14 02:45:45 +00:00
|
|
|
### BEGIN INIT INFO
|
|
|
|
# Provides: miniupnpd
|
|
|
|
# Required-Start: $remote_fs $syslog
|
|
|
|
# Required-Stop: $remote_fs $syslog
|
|
|
|
# Default-Start: 2 3 4 5
|
|
|
|
# Default-Stop: 0 1 6
|
|
|
|
# Short-Description: MiniUPnPd port-forwarding daemon
|
|
|
|
### END INIT INFO
|
|
|
|
|
2012-03-14 02:39:55 +00:00
|
|
|
set -e
|
|
|
|
|
2022-02-19 22:49:18 +00:00
|
|
|
ETCPATH=/etc/miniupnpd
|
2011-09-28 19:13:20 +00:00
|
|
|
MINIUPNPD=/usr/sbin/miniupnpd
|
2022-02-19 22:49:18 +00:00
|
|
|
ARGS="-f $ETCPATH/miniupnpd.conf"
|
2011-09-28 19:13:20 +00:00
|
|
|
|
2022-02-19 22:49:18 +00:00
|
|
|
if [ -f $ETCPATH/nft_init.sh ] ; then
|
|
|
|
IPTABLES_CREATE=$ETCPATH/nft_init.sh
|
|
|
|
IPTABLES_REMOVE=$ETCPATH/nft_removeall.sh
|
|
|
|
else
|
|
|
|
IPTABLES_CREATE=$ETCPATH/iptables_init.sh
|
|
|
|
IPTABLES_REMOVE=$ETCPATH/iptables_removeall.sh
|
|
|
|
fi
|
2011-09-28 19:13:20 +00:00
|
|
|
|
|
|
|
test -f $MINIUPNPD || exit 0
|
|
|
|
|
|
|
|
. /lib/lsb/init-functions
|
|
|
|
|
|
|
|
case "$1" in
|
2012-03-14 02:30:31 +00:00
|
|
|
start)
|
|
|
|
log_daemon_msg "Starting miniupnpd" "miniupnpd"
|
|
|
|
$IPTABLES_CREATE > /dev/null 2>&1
|
|
|
|
start-stop-daemon --start --quiet --pidfile /var/run/miniupnpd.pid --startas $MINIUPNPD -- $ARGS $LSBNAMES
|
|
|
|
log_end_msg $?
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
log_daemon_msg "Stopping miniupnpd" "miniupnpd"
|
|
|
|
start-stop-daemon --stop --quiet --pidfile /var/run/miniupnpd.pid
|
|
|
|
log_end_msg $?
|
|
|
|
$IPTABLES_REMOVE > /dev/null 2>&1
|
|
|
|
;;
|
|
|
|
restart|reload|force-reload)
|
|
|
|
log_daemon_msg "Restarting miniupnpd" "miniupnpd"
|
|
|
|
start-stop-daemon --stop --retry 5 --quiet --pidfile /var/run/miniupnpd.pid
|
|
|
|
$IPTABLES_REMOVE > /dev/null 2>&1
|
|
|
|
$IPTABLES_CREATE > /dev/null 2>&1
|
|
|
|
start-stop-daemon --start --quiet --pidfile /var/run/miniupnpd.pid --startas $MINIUPNPD -- $ARGS $LSBNAMES
|
|
|
|
log_end_msg $?
|
|
|
|
;;
|
2012-03-14 02:39:55 +00:00
|
|
|
status)
|
2022-02-19 22:49:18 +00:00
|
|
|
status_of_proc $MINIUPNPD miniupnpd
|
2012-03-14 02:39:55 +00:00
|
|
|
;;
|
2012-03-14 02:30:31 +00:00
|
|
|
*)
|
|
|
|
log_action_msg "Usage: /etc/init.d/miniupnpd {start|stop|restart|reload|force-reload}"
|
|
|
|
exit 2
|
|
|
|
;;
|
2011-09-28 19:13:20 +00:00
|
|
|
esac
|
|
|
|
exit 0
|