port lots of init scripts over to rc.common (more to come)

git-svn-id: svn://svn.openwrt.org/openwrt/packages@4917 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nbd 2006-10-04 20:57:49 +00:00
parent 8b4787b0c9
commit 2295d502f6
56 changed files with 640 additions and 711 deletions

View File

@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
BIN=avahi-daemon
DEFAULT=/etc/default/$BIN
@ -6,20 +7,16 @@ OPTIONS="-D"
RUN_D=/var/run/$BIN
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
mkdir -p $RUN_D
$BIN $OPTIONS
;;
stop)
$BIN -k
;;
reload)
$BIN -r
;;
*)
echo "usage: $0 (start|stop|reload)"
exit 1
esac
}
stop() {
$BIN -k
}
reload() {
$BIN -r
}
exit $?

View File

@ -1,20 +1,17 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
DEFAULT=/etc/default/autopid
RUN_D=/var/run
PID_F=$RUN_D/autoipd.pid
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
[ -d $RUN_D ] || mkdir -p $RUN_D
autoipd $OPTIONS
;;
stop)
}
stop() {
[ -f $PID_F ] && kill $(cat $PID_F)
;;
*)
echo "usage: $0 (start|stop)"
exit 1
esac
exit $?
}

View File

@ -5,16 +5,11 @@ RUN_D=/var/run
PID_F=$RUN_D/mDNSResponder.pid
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
[ -d $RUN_D ] || mkdir -p $RUN_D
mDNSResponder $OPTIONS
;;
stop)
}
stop() {
[ -f $PID_F ] && kill $(cat $PID_F)
;;
*)
echo "usage: $0 (start|stop)"
exit 1
esac
exit $?
}

View File

@ -1,21 +1,16 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
DEFAULT=/etc/default/nifd
RUN_D=/var/run
PID_F=$RUN_D/nifd.pid
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
[ -d $RUN_D ] || mkdir -p $RUN_D
nifd $OPTIONS
;;
stop)
}
stop() {
[ -f $PID_F ] && kill $(cat $PID_F)
;;
*)
echo "usage: $0 (start|stop)"
exit 1
esac
exit $?
}

View File

@ -1,21 +1,10 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
case "$1" in
start)
start() {
aiccu start
;;
}
stop)
stop() {
aiccu stop
aiccu stop
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
}

View File

@ -1,5 +1,12 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
start() {
if [ -f /etc/bind/named.conf ]; then
named -c /etc/bind/named.conf
fi
}
stop() {
killall named
}

View File

@ -1,7 +1,10 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
start() {
# make /tmp/.bitchxrc as many servers ban root
if [ ! -e /tmp/.bitchxrc ]
then
echo "IRCUSER OpenWrt" >/tmp/.bitchxrc
echo "IRCNAME OpenWrt User!" >>/tmp/.bitchxrc
fi
}

View File

@ -1,3 +1,11 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
start() {
mkdir -p /var/lib/bitlbee
bitlbee -D
}
stop() {
killall bitlbee
}

View File

@ -1,24 +1,18 @@
#!/bin/sh
. /etc/functions.sh
include /lib/network
scan_interfaces
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
RUN_D=/var/run
PID_F=$RUN_D/chilli.pid
case $1 in
start)
start() {
include /lib/network
scan_interfaces
/sbin/insmod tun >/dev/null 2>&1
[ -d $RUN_D ] || mkdir -p $RUN_D
config_get ipaddr lan ipaddr
/usr/sbin/chilli --dns1="$ipaddr"
;;
stop)
[ -f $PID_F ] && kill $(cat $PID_F) >/dev/null 2>&1
;;
*)
echo "usage: $0 (start|stop)"
exit 1
esac
}
exit $?
stop() {
[ -f $PID_F ] && kill $(cat $PID_F) >/dev/null 2>&1
}

View File

@ -1,7 +1,14 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
start() {
killall -q click
cp /usr/bin/srcr.click /tmp
sh /usr/bin/gen_config_roofnet.sh > /tmp/unaligned.click
click-align /tmp/unaligned.click > /tmp/roofnet.click
/usr/bin/click /tmp/roofnet.click > /tmp/roofnet.log 2>&1 &
}
stop() {
killall click
}

View File

@ -1,4 +1,12 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
start() {
mkdir -p /tmp/cups
mkdir -p /tmp/spool/cups/tmp
exec /usr/sbin/cupsd
/usr/sbin/cupsd
}
stop() {
killall cupsd
}

View File

@ -1,21 +1,17 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
LOG_D=/var/log
RUN_D=/var/run
PID_F=$RUN_D/dhcpd-fwd.pid
case $1 in
start)
start() {
[ -d $LOG_D ] || mkdir -p $LOG_D
[ -d $RUN_D ] || mkdir -p $RUN_D
dhcp-fwd
;;
stop)
[ -f $PID_F ] && kill $(cat $PID_F)
;;
*)
echo "usage: $0 (start|stop)"
exit 1
esac
}
stop() {
[ -f $PID_F ] && kill $(cat $PID_F)
}
exit $?

View File

@ -1,22 +1,17 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
BIN=ez-ipupdate
CONF=/etc/$BIN.conf
RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid
[ -f $CONF ] || exit
case $1 in
start)
start() {
[ -f $CONF ] || exit
mkdir -p $RUN_D
$BIN -c $CONF
;;
stop)
[ -f $PID_F ] && kill $(cat $PID_F)
;;
*)
echo "usage: $0 (start|stop)"
exit 1
esac
}
exit $?
stop() {
[ -f $PID_F ] && kill $(cat $PID_F)
}

View File

@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
DEFAULT=/etc/default/radiusd
LOG_D=/var/log/radius
@ -6,18 +7,12 @@ RUN_D=/var/run
PID_F=$RUN_D/radiusd.pid
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
[ -d $LOG_D ] || mkdir -p $LOG_D
[ -d $RUN_D ] || mkdir -p $RUN_D
radiusd $OPTIONS
;;
stop)
[ -f $PID_F ] && kill $(cat $PID_F)
;;
*)
echo "usage: $0 (start|stop)"
exit 1
esac
}
exit $?
stop() {
[ -f $PID_F ] && kill $(cat $PID_F)
}

View File

@ -1,16 +1,15 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
BIN=frickin
DEFAULT=/etc/default/$BIN
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
$BIN $OPTIONS &
;;
*)
echo "usage: $0 (start)"
exit 1
esac
}
stop() {
killall $BIN
}
exit $?

View File

@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
BIN=gmediaserver
DEFAULT=/etc/default/$BIN
@ -6,16 +7,11 @@ RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
$BIN $OPTIONS
;;
stop)
[ -f $PID_F ] && kill $(cat $PID_F)
;;
*)
echo "usage: $0 (start|stop)"
exit 1
esac
}
stop() {
[ -f $PID_F ] && kill $(cat $PID_F)
}
exit $?

View File

@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
BIN=htpdate
DEFAULT=/etc/default/$BIN
@ -6,17 +7,12 @@ RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
mkdir -p $RUN_D
$BIN -l -s -t $OPTIONS && $BIN -D $OPTIONS
;;
stop)
[ -f $PID_F ] && kill $(cat $PID_F)
;;
*)
echo "usage: $0 (start|stop)"
exit 1
esac
}
stop() {
[ -f $PID_F ] && kill $(cat $PID_F)
}
exit $?

View File

@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
BIN=l2tpd
DEFAULT=/etc/default/$BIN
@ -6,16 +7,11 @@ RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
$BIN $OPTIONS
;;
stop)
[ -f $PID_F ] && kill $(cat $PID_F)
;;
*)
echo "usage: $0 (start|stop)"
exit 1
esac
}
stop() {
[ -f $PID_F ] && kill $(cat $PID_F)
}
exit $?

View File

@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
BIN=lighttpd
DEFAULT=/etc/default/$BIN
@ -7,18 +8,13 @@ RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
mkdir -p $LOG_D
mkdir -p $RUN_D
$BIN $OPTIONS
;;
stop)
[ -f $PID_F ] && kill $(cat $PID_F)
;;
*)
echo "usage: $0 (start|stop)"
exit 1
esac
}
stop() {
[ -f $PID_F ] && kill $(cat $PID_F)
}
exit $?

View File

@ -1,5 +1,13 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
start() {
[ -d /etc/maradns ] || mkdir -p /etc/maradns
[ -d /etc/maradns/logger ] || mkdir -p /etc/maradns/logger
duende /usr/sbin/maradns
duende /usr/sbin/zoneserver
}
stop() {
killall duende maradns zoneserver
}

View File

@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
DEFAULT="/etc/default/miau"
OPTIONS="-d /etc/miau/"
@ -6,27 +7,24 @@ LOG_DIR="/var/log/miau"
ERR_LOG="$LOG_DIR/error.log"
OUT_LOG="$LOG_DIR/miau.log"
start() {
[ -f $DEFAULT ] && . $DEFAULT
[ "$ENABLE_MIAU" = "yes" ] || exit 0
case $1 in
start)
[ -f /var/run/miau.pid ] && echo "[ERROR] miau is running"
[ -f /var/run/miau.pid ] && exit 0
[ -d /var/run ] || mkdir -p /var/run
[ -f /var/run/miau.pid ] && {
echo "[ERROR] miau is running"
exit 0
}
[ -d $LOG_DIR ] || mkdir -p $LOG_DIR
/usr/bin/miau -f $OPTIONS > $OUT_LOG 2> $ERR_LOG &
PID=$!
sleep 1
[ -d /proc/$PID ] && echo $PID > /var/run/miau.pid
[ -d /proc/$PID ] || echo "[ERROR] Unable to run miau as a daemon"
;;
stop)
[ -f /var/run/miau.pid ] && kill $(cat /var/run/miau.pid) >/dev/null 2>&1 && rm /var/run/miau.pid
;;
*)
echo "usage: $0 (start|stop)"
exit 1
esac
if [ -d /proc/$PID ]; then
echo $PID > /var/run/miau.pid
else
echo "[ERROR] Unable to run miau as a daemon"
fi
}
exit $?
stop() {
[ -f /var/run/miau.pid ] && kill $(cat /var/run/miau.pid) >/dev/null 2>&1 && rm /var/run/miau.pid
}

View File

@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
BIN=mini_httpd
DEFAULT=/etc/default/$BIN
@ -6,21 +7,11 @@ RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
[ -d $RUN_D ] || mkdir -p $RUN_D
$BIN $OPTIONS 2>/dev/null
;;
stop)
[ -f $PID_F ] && kill $(cat $PID_F)
;;
restart)
$0 stop
$0 start
;;
*)
echo "usage: $0 (start|stop|restart)"
exit 1
esac
}
exit $?
stop() {
[ -f $PID_F ] && kill $(cat $PID_F)
}

View File

@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
BIN=miredo-server
DEFAULT=/etc/default/$BIN
@ -6,23 +7,13 @@ RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
[ -d $RUN_D ] || mkdir -p $RUN_D
insmod ipv6
insmod tun
$BIN $OPTIONS
;;
stop)
[ -f $PID_F ] && kill $(cat $PID_F)
;;
restart)
$0 stop
$0 start
;;
*)
echo "usage: $0 (start|stop|restart)"
exit 1
esac
}
exit $?
stop() {
[ -f $PID_F ] && kill $(cat $PID_F)
}

View File

@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
BIN=miredo
DEFAULT=/etc/default/$BIN
@ -6,23 +7,13 @@ RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
[ -d $RUN_D ] || mkdir -p $RUN_D
insmod ipv6
insmod tun
$BIN $OPTIONS
;;
stop)
[ -f $PID_F ] && kill $(cat $PID_F)
;;
restart)
$0 stop
$0 start
;;
*)
echo "usage: $0 (start|stop|restart)"
exit 1
esac
}
exit $?
stop() {
[ -f $PID_F ] && kill $(cat $PID_F)
}

View File

@ -1,3 +1,10 @@
#!/bin/sh
test -n "$FAILSAFE" && exit
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
start() {
/usr/bin/netserver
}
stop() {
killall netserver
}

View File

@ -1,8 +1,9 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
NFS_D=/var/lib/nfs
_start() {
start() {
mkdir -p $NFS_D
touch $NFS_D/rmtab
@ -13,7 +14,7 @@ _start() {
/usr/sbin/rpc.mountd
}
_stop() {
stop() {
killall rpc.mountd 2> /dev/null
killall -9 nfsd 2> /dev/null
/usr/sbin/exportfs -au
@ -21,27 +22,7 @@ _stop() {
killall rpc.statd 2> /dev/null
}
_reload() {
reload() {
/usr/sbin/exportfs -r
}
case $1 in
start)
_start
;;
stop)
_stop
;;
reload)
_reload
;;
restart)
_stop
sleep 1
_start
;;
*)
echo "usage: $0 (start|stop|reload|restart)"
exit 1
esac
exit $?

View File

@ -1,4 +1,14 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
start() {
/usr/sbin/portmap
/usr/sbin/rpc.mountd -r
/usr/sbin/rpc.nfsd
}
stop() {
killall rpc.nfsd
killall rpc.mountd
killall portmap
}

View File

@ -1,4 +1,6 @@
#!/bin/sh
# Copyright (C) 2006 OpenWrt.org
ntp_server=$(nvram get ntp_server)
case "${ACTION:-ifup}" in
ifup)

View File

@ -1,3 +1,10 @@
#!/bin/sh
/usr/sbin/oidentd -m -f 113
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
start() {
/usr/sbin/oidentd -m -f 113
}
stop() {
killall oidentd
}

View File

@ -1,15 +1,13 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
DEFAULT=/etc/default/olsrd
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
olsrd $OPTIONS
;;
*)
echo "usage: $0 (start)"
exit 1
esac
}
exit $?
stop() {
killall olsrd
}

View File

@ -1,3 +1,11 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
start() {
mkdir -p `awk -F: '/^ntp:/{print $6}' /etc/passwd`
/usr/sbin/ntpd -s
}
stop() {
killall ntpd
}

View File

@ -1,5 +1,7 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
start() {
for type in rsa dsa; do {
# check for keys
key=/etc/ssh/ssh_host_${type}_key
@ -13,3 +15,8 @@ for type in rsa dsa; do {
}; done
mkdir -p /var/empty
/usr/sbin/sshd
}
stop() {
killall sshd
}

View File

@ -1,15 +1,15 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
DEFAULT=/etc/default/p910nd
RUN_D=/var/run
_start() {
start() {
mkdir -p $RUN_D
[ -f $DEFAULT ] && (
while read port options; do
case "$port" in
""|\#*)
continue;
""|\#*) continue;;
esac
p910nd $options $port
if [ $? -ne 0 ]; then
@ -17,15 +17,13 @@ _start() {
fi
done
) < $DEFAULT
exit 0
}
_stop() {
stop() {
[ -f $DEFAULT ] && (
while read port options; do
case "$port" in
""|\#*)
continue;
""|\#*) continue;l
esac
PID_F=$RUN_D/p910${port}d.pid
[ -f $PID_F ] && kill $(cat $PID_F)
@ -33,15 +31,3 @@ _stop() {
) < $DEFAULT
}
case $1 in
start)
_start
;;
stop)
_stop
;;
*)
echo "usage: $0 (start|stop)"
exit 1
esac
exit $?

View File

@ -1,16 +1,14 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
BIN=parprouted
DEFAULT=/etc/default/$BIN
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
$BIN $OPTIONS
;;
*)
echo "usage: $0 (start)"
exit 1
esac
}
exit $?
stop() {
killall $BIN
}

View File

@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
BIN=pgtext
DEFAULT=/etc/default/$BIN
@ -6,16 +7,10 @@ DEFAULT=/etc/default/$BIN
RUN_D=/var/run
PID_F=$RUN_D/$BIN_${IF}_${ID}.pid
case $1 in
start)
start() {
$BIN $OPTIONS
;;
stop)
[ -f $PID_F ] && kill $(cat $PID_F) >/dev/null 2>&1
;;
*)
echo "usage: $0 (start|stop)"
exit 1
esac
}
exit $?
stop() {
[ -f $PID_F ] && kill $(cat $PID_F) >/dev/null 2>&1
}

View File

@ -1,16 +1,15 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
BIN=portmap
DEFAULT=/etc/default/$BIN
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
$BIN $OPTIONS
;;
*)
echo "usage: $0 start"
exit 1
esac
}
stop() {
killall $BIN
}
exit $?

View File

@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
BIN=pptpd
DEFAULT=/etc/default/$BIN
@ -6,20 +7,14 @@ RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
mkdir -p $RUN_D
for m in arc4 sha1 slhc crc-ccitt ppp_generic ppp_async ppp_mppe_mppc; do
insmod $m >/dev/null 2>&1
done
$BIN $OPTIONS
;;
stop)
[ -f $PID_F ] && kill $(cat $PID_F)
;;
*)
echo "usage: $0 (start|stop)"
exit 1
esac
}
exit $?
stop() {
[ -f $PID_F ] && kill $(cat $PID_F)
}

View File

@ -1,24 +1,14 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
case "$1" in
start)
start() {
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
mkdir -p /var/log
mkdir -p /var/run
/usr/sbin/radvd
;;
}
stop)
stop() {
killall radvd
echo 0 > /proc/sys/net/ipv6/conf/all/forwarding
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
}

View File

@ -1,7 +1,13 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
RARPD=/usr/sbin/rarpd
DEFAULT=/etc/default/rarpd
[ -f $DEFAULT ] && . $DEFAULT
start() {
$RARPD $OPTIONS
}
stop() {
killall rarpd
}

View File

@ -1,62 +1,47 @@
#! /bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=reaim
DESC="Transparent proxy for IM behind NAT"
. /etc/functions.sh
WAN=$(nvram get wan_ifname)
IPT=/usr/sbin/iptables
case "$1" in
start)
include /lib/network
scan_interfaces
config_get WAN wan ifname
set_rules() {
[ -z "$WAN" ] && exit
$IPT $1 input_rule -i $WAN -p tcp --dport 1863:1864 -j ACCEPT
$IPT $1 input_rule -i $WAN -p tcp --dport 4443 -j ACCEPT
$IPT $1 input_rule -i $WAN -p tcp --dport 5566 -j ACCEPT
$IPT $1 input_rule -i $WAN -p tcp --dport 40000:40099 -j ACCEPT
}
start() {
if [ -e /var/run/$NAME.pid ]; then
echo "$DESC: $NAME already started."
exit 0
fi
echo -n "Starting $DESC: $NAME"
$IPT -A input_rule -i $WAN -p tcp --dport 1863:1864 -j ACCEPT
$IPT -A input_rule -i $WAN -p tcp --dport 4443 -j ACCEPT
$IPT -A input_rule -i $WAN -p tcp --dport 5566 -j ACCEPT
$IPT -A input_rule -i $WAN -p tcp --dport 40000:40099 -j ACCEPT
set_rules -A
test -e /var/run/$NAME.pid || touch /var/run/$NAME.pid
/usr/sbin/$NAME
echo "."
;;
}
stop() {
set_rules -D 2>/dev/null >/dev/null
stop)
if [ ! -e /var/run/$NAME.pid ]; then
echo "$DESC: $NAME is not running."
exit 0
fi
echo -n "Stopping $DESC: $NAME"
killall $NAME
rm -f /var/run/$NAME.pid
echo "."
;;
restart|force-reload)
if [ ! -e /var/run/$NAME.pid ]; then
$0 start
exit 0
fi
echo -n "Restarting $DESC: $NAME"
$IPT -A input_rule -i $WAN -p tcp --dport 1863:1864 -j ACCEPT
$IPT -A input_rule -i $WAN -p tcp --dport 4443 -j ACCEPT
$IPT -A input_rule -i $WAN -p tcp --dport 5566 -j ACCEPT
$IPT -A input_rule -i $WAN -p tcp --dport 40000:40099 -j ACCEPT
killall $NAME
sleep 1
/usr/sbin/$NAME
echo "."
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
}

View File

@ -1,17 +1,16 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
DEFAULT=/etc/default/rp-l2tpd
RUN_D=/var/run
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
[ -d $RUN_D ] || mkdir -p $RUN_D
l2tpd $OPTIONS
;;
*)
echo "usage: $0 (start)"
exit 1
esac
}
stop() {
killall l2tpd
}
exit $?

View File

@ -1,12 +1,11 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
case "$1" in
start|stop)
adsl-$1
;;
*)
echo "usage: $0 {start|stop}"
exit 1
esac
start() {
adsl-start
}
stop() {
adsl-stop
}
exit $?

View File

@ -1,15 +1,14 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
DEFAULT=/etc/default/pppoe-relay
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
pppoe-relay $OPTIONS
;;
*)
echo "usage: $0 (start)"
exit 1
esac
}
stop() {
killall pppoe-relay
}
exit $?

View File

@ -1,15 +1,13 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
DEFAULT=/etc/default/pppoe-server
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
pppoe-server $OPTIONS
;;
*)
echo "usage: $0 (start)"
exit 1
esac
}
exit $?
stop() {
killall pppoe-server
}

View File

@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
DEFAULT=/etc/default/samba
RUN_D=/var/run/samba
@ -6,19 +7,13 @@ NMBD_PID_F=$RUN_D/nmbd.pid
SMBD_PID_F=$RUN_D/smbd.pid
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
mkdir -p $RUN_D
nmbd -D $NMBD_OPTIONS
smbd -D $SMBD_OPTIONS
;;
stop)
}
stop() {
[ -f $SMBD_PID_F ] && kill $(cat $SMBD_PID_F)
[ -f $NMBD_PID_F ] && kill $(cat $NMBD_PID_F)
;;
*)
echo "usage: $0 (start|stop)"
exit 1
esac
}
exit $?

View File

@ -1,3 +1,11 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
start() {
mkdir -p `grep "^scanlogd:" /etc/passwd | cut -d: -f6`
/usr/sbin/scanlogd
}
stop() {
killall scanlogd
}

View File

@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
BIN=siproxd
DEFAULT=/etc/default/$BIN
@ -6,16 +7,12 @@ RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
mkdir -p $RUN_D
$BIN $OPTIONS
;;
stop)
}
stop() {
[ -f $PID_F ] && kill $(cat $PID_F)
;;
*)
echo "usage: $0 (start|stop)"
exit 1
esac
exit $?
}

View File

@ -1,5 +1,12 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
start() {
if [ -f /etc/srelay.conf ];then
srelay -c /etc/srelay.conf -r -s
fi
}
stop() {
killall srelay
}

View File

@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
BIN=tor
DEFAULT=/etc/default/$BIN
@ -7,18 +8,13 @@ RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
mkdir -p $LOG_D
mkdir -p $RUN_D
$BIN $OPTIONS
;;
stop)
[ -f $PID_F ] && kill $(cat $PID_F)
;;
*)
echo "usage: $0 (start|stop)"
exit 1
esac
}
stop() {
[ -f $PID_F ] && kill $(cat $PID_F)
}
exit $?

View File

@ -1,17 +1,15 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
BIN=ulogd
DEFAULT=/etc/default/$BIN
LOG_D=/var/log
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
$BIN $OPTIONS
;;
*)
echo "usage: $0 (start)"
exit 1
esac
}
exit $?
stop() {
killall $BIN
}

View File

@ -1,4 +1,7 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
start() {
. /etc/nvram.sh
ddnsupdate=$(nvram get ddns_update)
@ -10,4 +13,8 @@ ddnsupdate=$(nvram get ddns_update)
/usr/bin/updatedd -Y $service -- $uname:$passwd $host
}
}
stop() {
killall updatedd
}

View File

@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
BIN=vrrpd
DEFAULT=/etc/default/$BIN
@ -6,16 +7,11 @@ DEFAULT=/etc/default/$BIN
RUN_D=/var/run
PID_F=$RUN_D/$BIN_${IF}_${ID}.pid
case $1 in
start)
start() {
$BIN $OPTIONS
;;
stop)
[ -f $PID_F ] && kill $(cat $PID_F) >/dev/null 2>&1
;;
*)
echo "usage: $0 (start|stop)"
exit 1
esac
}
stop() {
[ -f $PID_F ] && kill $(cat $PID_F) >/dev/null 2>&1
}
exit $?

View File

@ -1,15 +1,12 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
RUN_D=/var/run/vsftpd
case $1 in
start)
start() {
[ -d $RUN_D ] || mkdir -p $RUN_D
vsftpd
;;
*)
echo "usage: $0 (start)"
exit 1
esac
}
exit $?
stop() {
killall vsftpd
}

View File

@ -1,3 +1,11 @@
#!/bin/sh
/usr/bin/wifidog-init start
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
start() {
/usr/bin/wifidog-init start
}
stop() {
/usr/bin/wifidog-init stop
}

View File

@ -1,21 +1,17 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
DEFAULT=/etc/default/xinetd
RUN_D=/var/run
PID_F=$RUN_D/xinetd.pid
[ -f $DEFAULT ] && . $DEFAULT
case $1 in
start)
start() {
[ -d $RUN_D ] || mkdir -p $RUN_D
xinetd $OPTIONS
;;
stop)
[ -f $PID_F ] && kill $(cat $PID_F)
;;
*)
echo "usage: $0 (start|stop)"
exit 1
esac
}
stop() {
[ -f $PID_F ] && kill $(cat $PID_F)
}
exit $?

View File

@ -1,9 +1,11 @@
#!/bin/sh
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
BINARY="/usr/sbin/collectd"
PIDFILE="/var/run/collectd.pid"
DATADIR="/var/lib/collectd"
start() {
[ -x "$BINARY" ] || exit 1;
if [ -e "$PIDFILE" ]
@ -15,3 +17,8 @@ fi
[ -d "$DATADIR" ] || mkdir -p "$DATADIR";
$BINARY
}
stop() {
kill $(cat "$PIDFILE") 2>/dev/null
}