]> git.pld-linux.org Git - packages/rp-pppoe.git/blob - rp-pppoe-relay.init
- no -k option
[packages/rp-pppoe.git] / rp-pppoe-relay.init
1 #!/bin/sh
2 #
3 # pppoe-relay   PPP over Ethernet Relay Server
4 #
5 # chkconfig:    345 47 53
6 #
7 # description:  PPP over Ethernet Relay Server
8 #
9
10 # Source function library
11 . /etc/rc.d/init.d/functions
12
13 # Get network config
14 . /etc/sysconfig/network
15
16 # Get service config
17 [ -f /etc/sysconfig/pppoe-relay ] && . /etc/sysconfig/pppoe-relay
18
19 # Check that networking is up.
20 if is_yes "${NETWORKING}"; then
21         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
22                 msg_network_down "PPPoE Relay Server"
23                 exit 1
24         fi
25 else
26         exit 0
27 fi
28
29 PPPOE_RELAY_IFACES_SERVERS_OPT=
30 for iface in $PPPOE_RELAY_IFACES_SERVERS; do
31         PPPOE_RELAY_IFACES_SERVERS_OPT="-S $iface $$PPPOE_RELAY_IFACES_SERVERS"
32 done
33
34 PPPOE_RELAY_IFACES_CLIENTS=
35 for iface in $PPPOE_RELAY_IFACES_CLIENTS; do
36         PPPOE_RELAY_IFACES_CLIENTS_OPT="-C $iface $PPPOE_RELAY_IFACES_CLIENTS"
37 done
38 PPPOE_RELAY_IFACES_BOTH=
39 for iface in $PPPOE_RELAY_IFACES_BOTH; do
40         PPPOE_RELAY_IFACES_BOTH_OPT="-B $iface $PPPOE_RELAY_IFACES_BOTH"
41 done
42
43 [ -z "$PPPOE_RELAY_MAX_SESSIONS" ] && PPPOE_RELAY_MAX_SESSIONS=500
44 [ -z "$PPPOE_RELAY_TIMEOUT" ] && PPPOE_RELAY_TIMEOUT=600
45
46 RETVAL=0
47 # See how we were called.
48 case "$1" in
49   start)
50         # Check if the service is already running?
51         if [ ! -f /var/lock/subsys/pppoe-relay ]; then
52                 msg_starting "PPPoE Relay Server"
53                 for iface in $PPPOE_RELAY_IFACES_SERVERS $PPPOE_RELAY_IFACES_CLIENTS $PPPOE_RELAY_IFACES_BOTH; do
54                         ip link set $iface up 2> /dev/null
55                 done
56                 daemon /usr/sbin/pppoe-relay \
57                         $PPPOE_RELAY_IFACES_SERVERS_OPT \
58                         $PPPOE_RELAY_IFACES_CLIENTS_OPT \
59                         $PPPOE_RELAY_IFACES_BOTH_OPT \
60                         -n $PPPOE_RELAY_MAX_SESSIONS -i $PPPOE_RELAY_TIMEOUT
61                 RETVAL=$?
62                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pppoe-relay
63         else
64                 msg_already_running "PPPoE Relay Server"
65         fi
66         ;;
67   stop)
68         if [ -f /var/lock/subsys/pppoe-relay ]; then
69                 msg_stopping "PPPoE Relay Server"
70                 killproc pppoe-relay
71                 rm -f /var/lock/subsys/pppoe-relay >/dev/null 2>&1
72         else
73                 msg_not_running "PPPoE Relay Server"
74         fi
75         ;;
76   restart|force-reload)
77         $0 stop
78         $0 start
79         exit $?
80         ;;
81   status)
82         status pppoe-relay
83         exit $?
84         ;;
85   *)
86         msg_usage "$0 {start|stop|restart|force-reload|status}"
87         exit 3
88 esac
89
90 exit $RETVAL
This page took 0.062336 seconds and 3 git commands to generate.