Correct PPTP server firewall rules chain.
[tomato/davidwu.git] / release / src / router / hotplug2 / examples / hotplug2.initscript
blobe94d032a40bacec2cb6e19263e058dbd69005ee2
1 #! /bin/sh
3 # Author: iSteve <isteve@bofh.cz>
5 # Note that this script is untested!
7 # PATH should only include /usr/* if it runs after the mountnfs.sh script
8 PATH=/sbin:/bin
9 DESC="Hotplug2"
10 NAME=hotplug2
11 DAEMON=/sbin/$NAME
12 DAEMON_ARGS="--coldplug --persistent"
13 PIDFILE=/var/run/$NAME.pid
14 SCRIPTNAME=/etc/init.d/$NAME
16 # Load the VERBOSE setting and other rcS variables
17 [ -f /etc/default/rcS ] && . /etc/default/rcS
19 # Define LSB log_* functions.
20 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
21 . /lib/lsb/init-functions
24 # Function that starts the daemon/service
26 do_start()
28 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
29 || return 1
30 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
31 $DAEMON_ARGS \
32 || return 2
36 # Function that stops the daemon/service
38 do_stop()
40 start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
41 RETVAL="$?"
42 [ "$RETVAL" = 2 ] && return 2
44 start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
45 [ "$?" = 2 ] && return 2
46 # Many daemons don't delete their pidfiles when they exit.
47 rm -f $PIDFILE
48 return "$RETVAL"
51 case "$1" in
52 start)
53 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
55 case "$(uname -r)" in
56 2.[0123].*)
57 log_end_msg 0
58 exit 1;
60 2.[45].*)
61 echo "/sbin/hotplug2-dnode" > /proc/sys/kernel/hotplug
62 DAEMON_ARGS=${DAEMON_ARGS}" --set-coldplug-cmd /sbin/hotplug2-coldplug-2.4"
65 # 2.6 needs no extra flags
67 esac
69 do_start
70 case "$?" in
71 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
72 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
73 esac
75 stop)
76 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
77 do_stop
78 case "$?" in
79 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
80 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
81 esac
84 echo "Usage: $SCRIPTNAME {start|stop}" >&2
85 exit 3
87 esac