summaryrefslogtreecommitdiff
path: root/network/miniupnpd/rc.miniupnpd
blob: 1d8b6c594fd36b7cc65045be3c998ece4a7dbd73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh

# $Id: miniupnpd.init.d.script,v 1.2 2007/09/23 16:11:12 nanard Exp $
# MiniUPnP project
# author: Thomas Bernard
# website: http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/

# Re-created from scratch by the SlackBuild's author Pablo Oses <opablo@gmail.com>
# using the simple service start/stop/restart script template

SERVICENAME="miniupnpd"
CONFIGPATH=/etc/miniupnpd
BINPATH=/usr/sbin

# Start service:
start()
{
  echo -n "Starting $SERVICENAME..."
  ${CONFIGPATH}/iptables_init.sh > /dev/null 2>&1
  ${BINPATH}/miniupnpd -f ${CONFIGPATH}/miniupnpd.conf
  echo
}

# Stop service:
stop()
{
  echo -n "Stopping ${SERVICENAME}... "
  killall miniupnpd
  ${CONFIGPATH}/iptables_removeall.sh > /dev/null 2>&1
  echo
}

# Restart service:
restart()
{
  stop
  sleep 1
  start
}

case "$1" in
  'start')
    start
    ;;
  'stop')
    stop
    ;;
  'restart')
    restart
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"
esac