summaryrefslogtreecommitdiffstats
path: root/testing/rp-pppoe/rp-pppoe.initd
blob: 871e5d8cd99f6e9a0bbc69198c4dedf5381c3c9a (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
#!/bin/sh
#

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/pppoe-server
NAME=pppoe-server

# Setup server and service names, Server peer IP, start of IP range for clients peers, amount of peers at same time
PARAMS="-C XGT01 -S RESNET -L 172.19.${BRNUM}.2 -R 172.19.${BRNUM}.100 -N 100"

test -x /usr/sbin/pppoe-server -a -f /etc/ppp/pppoe-server-options || exit 0

case "$1" in
    start)
        echo -n "Starting up $NAME "
        start-stop-daemon --start --quiet --pidfile /var/run/$NAME/$NAME.pid --exec $DAEMON -- $PARAMS
        echo 1 > /proc/sys/net/ipv4/ip_forward
        echo "."
        ;;
    stop)
        echo -n "Shutting down $NAME "
        start-stop-daemon --stop --quiet --pidfile /var/run/$NAME/$NAME.pid --exec $DAEMON
        echo 0 > /proc/sys/net/ipv4/ip_forward
        killall $DAEMON > /dev/null 2>&1
        echo "."
        ;;
    restart|force-reload)
        echo -n "Restarting $NAME "
        start-stop-daemon --stop --quiet --pidfile /var/run/$NAME/$NAME.pid --exec $DAEMON
        sleep 1
        start-stop-daemon --start --quiet --pidfile /var/run/$NAME/$NAME.pid --exec $DAEMON -- $PARAMS
        echo "."
        ;;
    *)
        echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}"
        exit 1
        ;;
esac

exit 0