libsodium: Needed for Dnscrypto-proxy Release 1.3.0
[tomato.git] / release / src / router / miniupnpd / linux / miniupnpd.init.d.script
blobee6e47b0319a4f2b8e49cde8d9bc19077877a8af
1 #!/bin/sh
2 # $Id: miniupnpd.init.d.script,v 1.3 2012/03/14 22:09:53 nanard Exp $
3 # MiniUPnP project
4 # author: Thomas Bernard
5 # website: http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
7 ### BEGIN INIT INFO
8 # Provides: miniupnpd
9 # Required-Start: $remote_fs $syslog
10 # Required-Stop: $remote_fs $syslog
11 # Default-Start: 2 3 4 5
12 # Default-Stop: 0 1 6
13 # Short-Description: MiniUPnPd port-forwarding daemon
14 ### END INIT INFO
16 set -e
18 MINIUPNPD=/usr/sbin/miniupnpd
19 ARGS='-f /etc/miniupnpd/miniupnpd.conf'
21 IPTABLES_CREATE=/etc/miniupnpd/iptables_init.sh
22 IPTABLES_REMOVE=/etc/miniupnpd/iptables_removeall.sh
24 test -f $MINIUPNPD || exit 0
26 . /lib/lsb/init-functions
28 case "$1" in
29 start)
30 log_daemon_msg "Starting miniupnpd" "miniupnpd"
31 $IPTABLES_CREATE > /dev/null 2>&1
32 start-stop-daemon --start --quiet --pidfile /var/run/miniupnpd.pid --startas $MINIUPNPD -- $ARGS $LSBNAMES
33 log_end_msg $?
35 stop)
36 log_daemon_msg "Stopping miniupnpd" "miniupnpd"
37 start-stop-daemon --stop --quiet --pidfile /var/run/miniupnpd.pid
38 log_end_msg $?
39 $IPTABLES_REMOVE > /dev/null 2>&1
41 restart|reload|force-reload)
42 log_daemon_msg "Restarting miniupnpd" "miniupnpd"
43 start-stop-daemon --stop --retry 5 --quiet --pidfile /var/run/miniupnpd.pid
44 $IPTABLES_REMOVE > /dev/null 2>&1
45 $IPTABLES_CREATE > /dev/null 2>&1
46 start-stop-daemon --start --quiet --pidfile /var/run/miniupnpd.pid --startas $MINIUPNPD -- $ARGS $LSBNAMES
47 log_end_msg $?
49 status)
50 status_of_proc /usr/sbin/miniupnpd miniupnpd
53 log_action_msg "Usage: /etc/init.d/miniupnpd {start|stop|restart|reload|force-reload}"
54 exit 2
56 esac
57 exit 0