freewrt_1_0
freewrt_2_0
|
Last change
on this file since 583d755 was 583d755, checked in by Thorsten Glaser <tg@…>, 19 years ago |
- change the SYSV init system to add a target "autostart"
- on system startup, call autostart instead of start
- on autostart, check /etc/rc.conf for whether the service is
enabled and act appropriately; fall through into start target
- move some pre-startup checks into the start target
- some whitespace cleanup, when it makes much sense
(XXX when I get the person who wrote these scripts...)
- optimise dropbear a little
ok and approved wbx@
git-svn-id: svn://www.freewrt.org/trunk/freewrt@191 afb5a338-a214-0410-bd46-81f09a774fd1
|
-
Property mode
set to
100644
|
|
File size:
1.7 KB
|
| Line | |
|---|
| 1 | #! /bin/sh
|
|---|
| 2 |
|
|---|
| 3 | PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
|---|
| 4 | NAME=reaim
|
|---|
| 5 | DESC="Transparent proxy for IM behind NAT"
|
|---|
| 6 | . /etc/functions.sh
|
|---|
| 7 | WAN=$(nvram get wan_ifname)
|
|---|
| 8 | IPT=/usr/sbin/iptables
|
|---|
| 9 | case "$1" in
|
|---|
| 10 | autostart|start)
|
|---|
| 11 | if [ -e /var/run/$NAME.pid ]; then
|
|---|
| 12 | echo "$DESC: $NAME already started."
|
|---|
| 13 | exit 0
|
|---|
| 14 | fi
|
|---|
| 15 | echo -n "Starting $DESC: $NAME"
|
|---|
| 16 | $IPT -A input_rule -i $WAN -p tcp --dport 1863:1864 -j ACCEPT
|
|---|
| 17 | $IPT -A input_rule -i $WAN -p tcp --dport 4443 -j ACCEPT
|
|---|
| 18 | $IPT -A input_rule -i $WAN -p tcp --dport 5566 -j ACCEPT
|
|---|
| 19 | $IPT -A input_rule -i $WAN -p tcp --dport 40000:40099 -j ACCEPT
|
|---|
| 20 |
|
|---|
| 21 | test -e /var/run/$NAME.pid || touch /var/run/$NAME.pid
|
|---|
| 22 | /usr/sbin/$NAME
|
|---|
| 23 | echo "."
|
|---|
| 24 | ;;
|
|---|
| 25 |
|
|---|
| 26 | stop)
|
|---|
| 27 | if [ ! -e /var/run/$NAME.pid ]; then
|
|---|
| 28 | echo "$DESC: $NAME is not running."
|
|---|
| 29 | exit 0
|
|---|
| 30 | fi
|
|---|
| 31 | echo -n "Stopping $DESC: $NAME"
|
|---|
| 32 | killall $NAME
|
|---|
| 33 | rm -f /var/run/$NAME.pid
|
|---|
| 34 |
|
|---|
| 35 | echo "."
|
|---|
| 36 | ;;
|
|---|
| 37 |
|
|---|
| 38 | restart|force-reload)
|
|---|
| 39 | if [ ! -e /var/run/$NAME.pid ]; then
|
|---|
| 40 | $0 start
|
|---|
| 41 | exit 0
|
|---|
| 42 | fi
|
|---|
| 43 | echo -n "Restarting $DESC: $NAME"
|
|---|
| 44 | $IPT -A input_rule -i $WAN -p tcp --dport 1863:1864 -j ACCEPT
|
|---|
| 45 | $IPT -A input_rule -i $WAN -p tcp --dport 4443 -j ACCEPT
|
|---|
| 46 | $IPT -A input_rule -i $WAN -p tcp --dport 5566 -j ACCEPT
|
|---|
| 47 | $IPT -A input_rule -i $WAN -p tcp --dport 40000:40099 -j ACCEPT
|
|---|
| 48 | killall $NAME
|
|---|
| 49 | sleep 1
|
|---|
| 50 | /usr/sbin/$NAME
|
|---|
| 51 | echo "."
|
|---|
| 52 | ;;
|
|---|
| 53 |
|
|---|
| 54 | *)
|
|---|
| 55 | N=/etc/init.d/$NAME
|
|---|
| 56 | echo "Usage: $N {start|stop|restart|force-reload}" >&2
|
|---|
| 57 | exit 1
|
|---|
| 58 | ;;
|
|---|
| 59 |
|
|---|
| 60 | esac
|
|---|
| 61 |
|
|---|
| 62 | exit 0
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.