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 BIN=avahi-daemon
DEFAULT=/etc/default/$BIN DEFAULT=/etc/default/$BIN
@ -6,20 +7,16 @@ OPTIONS="-D"
RUN_D=/var/run/$BIN RUN_D=/var/run/$BIN
[ -f $DEFAULT ] && . $DEFAULT [ -f $DEFAULT ] && . $DEFAULT
case $1 in start() {
start) mkdir -p $RUN_D
mkdir -p $RUN_D $BIN $OPTIONS
$BIN $OPTIONS }
;;
stop) stop() {
$BIN -k $BIN -k
;; }
reload)
$BIN -r reload() {
;; $BIN -r
*) }
echo "usage: $0 (start|stop|reload)"
exit 1
esac
exit $?

View File

@ -1,20 +1,17 @@
#!/bin/sh #!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
DEFAULT=/etc/default/autopid DEFAULT=/etc/default/autopid
RUN_D=/var/run RUN_D=/var/run
PID_F=$RUN_D/autoipd.pid PID_F=$RUN_D/autoipd.pid
[ -f $DEFAULT ] && . $DEFAULT [ -f $DEFAULT ] && . $DEFAULT
case $1 in start() {
start) [ -d $RUN_D ] || mkdir -p $RUN_D
[ -d $RUN_D ] || mkdir -p $RUN_D autoipd $OPTIONS
autoipd $OPTIONS }
;;
stop) stop() {
[ -f $PID_F ] && kill $(cat $PID_F) [ -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 PID_F=$RUN_D/mDNSResponder.pid
[ -f $DEFAULT ] && . $DEFAULT [ -f $DEFAULT ] && . $DEFAULT
case $1 in start() {
start) [ -d $RUN_D ] || mkdir -p $RUN_D
[ -d $RUN_D ] || mkdir -p $RUN_D mDNSResponder $OPTIONS
mDNSResponder $OPTIONS }
;; stop() {
stop) [ -f $PID_F ] && kill $(cat $PID_F)
[ -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 DEFAULT=/etc/default/nifd
RUN_D=/var/run RUN_D=/var/run
PID_F=$RUN_D/nifd.pid PID_F=$RUN_D/nifd.pid
[ -f $DEFAULT ] && . $DEFAULT [ -f $DEFAULT ] && . $DEFAULT
case $1 in start() {
start) [ -d $RUN_D ] || mkdir -p $RUN_D
[ -d $RUN_D ] || mkdir -p $RUN_D nifd $OPTIONS
nifd $OPTIONS }
;; stop() {
stop) [ -f $PID_F ] && kill $(cat $PID_F)
[ -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 aiccu start
;; }
stop) stop() {
aiccu 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
if [ -f /etc/bind/named.conf ]; then start() {
named -c /etc/bind/named.conf if [ -f /etc/bind/named.conf ]; then
fi named -c /etc/bind/named.conf
fi
}
stop() {
killall named
}

View File

@ -1,7 +1,10 @@
#!/bin/sh #!/bin/sh /etc/rc.common
# make /tmp/.bitchxrc as many servers ban root
if [ ! -e /tmp/.bitchxrc ] start() {
then # make /tmp/.bitchxrc as many servers ban root
echo "IRCUSER OpenWrt" >/tmp/.bitchxrc if [ ! -e /tmp/.bitchxrc ]
echo "IRCNAME OpenWrt User!" >>/tmp/.bitchxrc then
fi 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
mkdir -p /var/lib/bitlbee # Copyright (C) 2006 OpenWrt.org
bitlbee -D
start() {
mkdir -p /var/lib/bitlbee
bitlbee -D
}
stop() {
killall bitlbee
}

View File

@ -1,24 +1,18 @@
#!/bin/sh #!/bin/sh /etc/rc.common
. /etc/functions.sh # Copyright (C) 2006 OpenWrt.org
include /lib/network
scan_interfaces
RUN_D=/var/run RUN_D=/var/run
PID_F=$RUN_D/chilli.pid PID_F=$RUN_D/chilli.pid
case $1 in start() {
start) include /lib/network
/sbin/insmod tun >/dev/null 2>&1 scan_interfaces
[ -d $RUN_D ] || mkdir -p $RUN_D /sbin/insmod tun >/dev/null 2>&1
config_get ipaddr lan ipaddr [ -d $RUN_D ] || mkdir -p $RUN_D
/usr/sbin/chilli --dns1="$ipaddr" 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
killall -q click start() {
cp /usr/bin/srcr.click /tmp killall -q click
sh /usr/bin/gen_config_roofnet.sh > /tmp/unaligned.click cp /usr/bin/srcr.click /tmp
click-align /tmp/unaligned.click > /tmp/roofnet.click sh /usr/bin/gen_config_roofnet.sh > /tmp/unaligned.click
/usr/bin/click /tmp/roofnet.click > /tmp/roofnet.log 2>&1 & 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
mkdir -p /tmp/cups # Copyright (C) 2006 OpenWrt.org
mkdir -p /tmp/spool/cups/tmp
exec /usr/sbin/cupsd start() {
mkdir -p /tmp/cups
mkdir -p /tmp/spool/cups/tmp
/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 LOG_D=/var/log
RUN_D=/var/run RUN_D=/var/run
PID_F=$RUN_D/dhcpd-fwd.pid PID_F=$RUN_D/dhcpd-fwd.pid
case $1 in start() {
start) [ -d $LOG_D ] || mkdir -p $LOG_D
[ -d $LOG_D ] || mkdir -p $LOG_D [ -d $RUN_D ] || mkdir -p $RUN_D
[ -d $RUN_D ] || mkdir -p $RUN_D dhcp-fwd
dhcp-fwd }
;;
stop) stop() {
[ -f $PID_F ] && kill $(cat $PID_F) [ -f $PID_F ] && kill $(cat $PID_F)
;; }
*)
echo "usage: $0 (start|stop)"
exit 1
esac
exit $?

View File

@ -1,22 +1,17 @@
#!/bin/sh #!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
BIN=ez-ipupdate BIN=ez-ipupdate
CONF=/etc/$BIN.conf CONF=/etc/$BIN.conf
RUN_D=/var/run RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid PID_F=$RUN_D/$BIN.pid
[ -f $CONF ] || exit
case $1 in start() {
start) [ -f $CONF ] || exit
mkdir -p $RUN_D mkdir -p $RUN_D
$BIN -c $CONF $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 DEFAULT=/etc/default/radiusd
LOG_D=/var/log/radius LOG_D=/var/log/radius
@ -6,18 +7,12 @@ RUN_D=/var/run
PID_F=$RUN_D/radiusd.pid PID_F=$RUN_D/radiusd.pid
[ -f $DEFAULT ] && . $DEFAULT [ -f $DEFAULT ] && . $DEFAULT
case $1 in start() {
start) [ -d $LOG_D ] || mkdir -p $LOG_D
[ -d $LOG_D ] || mkdir -p $LOG_D [ -d $RUN_D ] || mkdir -p $RUN_D
[ -d $RUN_D ] || mkdir -p $RUN_D radiusd $OPTIONS
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 BIN=frickin
DEFAULT=/etc/default/$BIN DEFAULT=/etc/default/$BIN
[ -f $DEFAULT ] && . $DEFAULT [ -f $DEFAULT ] && . $DEFAULT
case $1 in start() {
start) $BIN $OPTIONS &
$BIN $OPTIONS & }
;;
*) stop() {
echo "usage: $0 (start)" killall $BIN
exit 1 }
esac
exit $?

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,5 @@
#!/bin/sh #!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
BIN=mini_httpd BIN=mini_httpd
DEFAULT=/etc/default/$BIN DEFAULT=/etc/default/$BIN
@ -6,21 +7,11 @@ RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid PID_F=$RUN_D/$BIN.pid
[ -f $DEFAULT ] && . $DEFAULT [ -f $DEFAULT ] && . $DEFAULT
case $1 in start() {
start) [ -d $RUN_D ] || mkdir -p $RUN_D
[ -d $RUN_D ] || mkdir -p $RUN_D $BIN $OPTIONS 2>/dev/null
$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 BIN=miredo-server
DEFAULT=/etc/default/$BIN DEFAULT=/etc/default/$BIN
@ -6,23 +7,13 @@ RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid PID_F=$RUN_D/$BIN.pid
[ -f $DEFAULT ] && . $DEFAULT [ -f $DEFAULT ] && . $DEFAULT
case $1 in start() {
start) [ -d $RUN_D ] || mkdir -p $RUN_D
[ -d $RUN_D ] || mkdir -p $RUN_D insmod ipv6
insmod ipv6 insmod tun
insmod tun $BIN $OPTIONS
$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 BIN=miredo
DEFAULT=/etc/default/$BIN DEFAULT=/etc/default/$BIN
@ -6,23 +7,13 @@ RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid PID_F=$RUN_D/$BIN.pid
[ -f $DEFAULT ] && . $DEFAULT [ -f $DEFAULT ] && . $DEFAULT
case $1 in start() {
start) [ -d $RUN_D ] || mkdir -p $RUN_D
[ -d $RUN_D ] || mkdir -p $RUN_D insmod ipv6
insmod ipv6 insmod tun
insmod tun $BIN $OPTIONS
$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 #!/bin/sh /etc/rc.common
test -n "$FAILSAFE" && exit # Copyright (C) 2006 OpenWrt.org
/usr/bin/netserver
start() {
/usr/bin/netserver
}
stop() {
killall netserver
}

View File

@ -1,47 +1,28 @@
#!/bin/sh #!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
NFS_D=/var/lib/nfs NFS_D=/var/lib/nfs
_start() { start() {
mkdir -p $NFS_D mkdir -p $NFS_D
touch $NFS_D/rmtab touch $NFS_D/rmtab
/usr/sbin/rpc.statd /usr/sbin/rpc.statd
/usr/sbin/rpc.lockd /usr/sbin/rpc.lockd
/usr/sbin/exportfs -r /usr/sbin/exportfs -r
/usr/sbin/rpc.nfsd /usr/sbin/rpc.nfsd
/usr/sbin/rpc.mountd /usr/sbin/rpc.mountd
} }
_stop() { stop() {
killall rpc.mountd 2> /dev/null killall rpc.mountd 2> /dev/null
killall -9 nfsd 2> /dev/null killall -9 nfsd 2> /dev/null
/usr/sbin/exportfs -au /usr/sbin/exportfs -au
killall lockd 2> /dev/null killall lockd 2> /dev/null
killall rpc.statd 2> /dev/null killall rpc.statd 2> /dev/null
} }
_reload() { reload() {
/usr/sbin/exportfs -r /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
/usr/sbin/portmap # Copyright (C) 2006 OpenWrt.org
/usr/sbin/rpc.mountd -r
/usr/sbin/rpc.nfsd 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 #!/bin/sh
# Copyright (C) 2006 OpenWrt.org
ntp_server=$(nvram get ntp_server) ntp_server=$(nvram get ntp_server)
case "${ACTION:-ifup}" in case "${ACTION:-ifup}" in
ifup) ifup)

View File

@ -1,3 +1,10 @@
#!/bin/sh #!/bin/sh /etc/rc.common
/usr/sbin/oidentd -m -f 113 # 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 DEFAULT=/etc/default/olsrd
[ -f $DEFAULT ] && . $DEFAULT [ -f $DEFAULT ] && . $DEFAULT
case $1 in start() {
start) olsrd $OPTIONS
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
mkdir -p `awk -F: '/^ntp:/{print $6}' /etc/passwd` # Copyright (C) 2006 OpenWrt.org
/usr/sbin/ntpd -s
start() {
mkdir -p `awk -F: '/^ntp:/{print $6}' /etc/passwd`
/usr/sbin/ntpd -s
}
stop() {
killall ntpd
}

View File

@ -1,15 +1,22 @@
#!/bin/sh #!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
for type in rsa dsa; do { start() {
# check for keys for type in rsa dsa; do {
key=/etc/ssh/ssh_host_${type}_key # check for keys
[ ! -f $key ] && { key=/etc/ssh/ssh_host_${type}_key
# generate missing keys [ ! -f $key ] && {
[ -x /usr/bin/ssh-keygen ] && { # generate missing keys
/usr/bin/ssh-keygen -N '' -t $type -f $key 2>&- >&- && exec $0 $* [ -x /usr/bin/ssh-keygen ] && {
} & /usr/bin/ssh-keygen -N '' -t $type -f $key 2>&- >&- && exec $0 $*
exit 0 } &
} exit 0
}; done }
mkdir -p /var/empty }; done
/usr/sbin/sshd mkdir -p /var/empty
/usr/sbin/sshd
}
stop() {
killall sshd
}

View File

@ -1,47 +1,33 @@
#!/bin/sh #!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
DEFAULT=/etc/default/p910nd DEFAULT=/etc/default/p910nd
RUN_D=/var/run RUN_D=/var/run
_start() { start() {
mkdir -p $RUN_D mkdir -p $RUN_D
[ -f $DEFAULT ] && ( [ -f $DEFAULT ] && (
while read port options; do while read port options; do
case "$port" in case "$port" in
""|\#*) ""|\#*) continue;;
continue; esac
esac p910nd $options $port
p910nd $options $port if [ $? -ne 0 ]; then
if [ $? -ne 0 ]; then exit 1
exit 1 fi
fi done
done ) < $DEFAULT
) < $DEFAULT
exit 0
} }
_stop() { stop() {
[ -f $DEFAULT ] && ( [ -f $DEFAULT ] && (
while read port options; do while read port options; do
case "$port" in case "$port" in
""|\#*) ""|\#*) continue;l
continue; esac
esac PID_F=$RUN_D/p910${port}d.pid
PID_F=$RUN_D/p910${port}d.pid [ -f $PID_F ] && kill $(cat $PID_F)
[ -f $PID_F ] && kill $(cat $PID_F) done
done ) < $DEFAULT
) < $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 BIN=parprouted
DEFAULT=/etc/default/$BIN DEFAULT=/etc/default/$BIN
[ -f $DEFAULT ] && . $DEFAULT [ -f $DEFAULT ] && . $DEFAULT
case $1 in start() {
start) $BIN $OPTIONS
$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 BIN=pgtext
DEFAULT=/etc/default/$BIN DEFAULT=/etc/default/$BIN
@ -6,16 +7,10 @@ DEFAULT=/etc/default/$BIN
RUN_D=/var/run RUN_D=/var/run
PID_F=$RUN_D/$BIN_${IF}_${ID}.pid PID_F=$RUN_D/$BIN_${IF}_${ID}.pid
case $1 in start() {
start) $BIN $OPTIONS
$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 BIN=portmap
DEFAULT=/etc/default/$BIN DEFAULT=/etc/default/$BIN
[ -f $DEFAULT ] && . $DEFAULT [ -f $DEFAULT ] && . $DEFAULT
case $1 in start() {
start) $BIN $OPTIONS
$BIN $OPTIONS }
;;
*) stop() {
echo "usage: $0 start" killall $BIN
exit 1 }
esac
exit $?

View File

@ -1,4 +1,5 @@
#!/bin/sh #!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
BIN=pptpd BIN=pptpd
DEFAULT=/etc/default/$BIN DEFAULT=/etc/default/$BIN
@ -6,20 +7,14 @@ RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid PID_F=$RUN_D/$BIN.pid
[ -f $DEFAULT ] && . $DEFAULT [ -f $DEFAULT ] && . $DEFAULT
case $1 in start() {
start) mkdir -p $RUN_D
mkdir -p $RUN_D for m in arc4 sha1 slhc crc-ccitt ppp_generic ppp_async ppp_mppe_mppc; do
for m in arc4 sha1 slhc crc-ccitt ppp_generic ppp_async ppp_mppe_mppc; do insmod $m >/dev/null 2>&1
insmod $m >/dev/null 2>&1 done
done $BIN $OPTIONS
$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 echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
mkdir -p /var/log mkdir -p /var/log
mkdir -p /var/run mkdir -p /var/run
/usr/sbin/radvd /usr/sbin/radvd
;; }
stop) stop() {
killall radvd killall radvd
echo 0 > /proc/sys/net/ipv6/conf/all/forwarding 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 RARPD=/usr/sbin/rarpd
DEFAULT=/etc/default/rarpd DEFAULT=/etc/default/rarpd
[ -f $DEFAULT ] && . $DEFAULT [ -f $DEFAULT ] && . $DEFAULT
$RARPD $OPTIONS 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 PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=reaim NAME=reaim
DESC="Transparent proxy for IM behind NAT" DESC="Transparent proxy for IM behind NAT"
. /etc/functions.sh
WAN=$(nvram get wan_ifname)
IPT=/usr/sbin/iptables IPT=/usr/sbin/iptables
case "$1" in
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
test -e /var/run/$NAME.pid || touch /var/run/$NAME.pid include /lib/network
/usr/sbin/$NAME scan_interfaces
echo "." config_get WAN wan ifname
;;
stop) set_rules() {
if [ ! -e /var/run/$NAME.pid ]; then [ -z "$WAN" ] && exit
echo "$DESC: $NAME is not running." $IPT $1 input_rule -i $WAN -p tcp --dport 1863:1864 -j ACCEPT
exit 0 $IPT $1 input_rule -i $WAN -p tcp --dport 4443 -j ACCEPT
fi $IPT $1 input_rule -i $WAN -p tcp --dport 5566 -j ACCEPT
echo -n "Stopping $DESC: $NAME" $IPT $1 input_rule -i $WAN -p tcp --dport 40000:40099 -j ACCEPT
killall $NAME }
rm -f /var/run/$NAME.pid
echo "." start() {
;; if [ -e /var/run/$NAME.pid ]; then
echo "$DESC: $NAME already started."
exit 0
fi
echo -n "Starting $DESC: $NAME"
set_rules -A
test -e /var/run/$NAME.pid || touch /var/run/$NAME.pid
/usr/sbin/$NAME
echo "."
}
restart|force-reload) stop() {
if [ ! -e /var/run/$NAME.pid ]; then set_rules -D 2>/dev/null >/dev/null
$0 start
exit 0 if [ ! -e /var/run/$NAME.pid ]; then
fi echo "$DESC: $NAME is not running."
echo -n "Restarting $DESC: $NAME" exit 0
$IPT -A input_rule -i $WAN -p tcp --dport 1863:1864 -j ACCEPT fi
$IPT -A input_rule -i $WAN -p tcp --dport 4443 -j ACCEPT echo -n "Stopping $DESC: $NAME"
$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 "."
;;
*) killall $NAME
N=/etc/init.d/$NAME rm -f /var/run/$NAME.pid
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac echo "."
}
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 DEFAULT=/etc/default/rp-l2tpd
RUN_D=/var/run RUN_D=/var/run
[ -f $DEFAULT ] && . $DEFAULT [ -f $DEFAULT ] && . $DEFAULT
case $1 in start() {
start) [ -d $RUN_D ] || mkdir -p $RUN_D
[ -d $RUN_D ] || mkdir -p $RUN_D l2tpd $OPTIONS
l2tpd $OPTIONS }
;;
*) stop() {
echo "usage: $0 (start)" killall l2tpd
exit 1 }
esac
exit $?

View File

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

View File

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

View File

@ -1,15 +1,13 @@
#!/bin/sh #!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
DEFAULT=/etc/default/pppoe-server DEFAULT=/etc/default/pppoe-server
[ -f $DEFAULT ] && . $DEFAULT [ -f $DEFAULT ] && . $DEFAULT
case $1 in start() {
start) pppoe-server $OPTIONS
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 DEFAULT=/etc/default/samba
RUN_D=/var/run/samba RUN_D=/var/run/samba
@ -6,19 +7,13 @@ NMBD_PID_F=$RUN_D/nmbd.pid
SMBD_PID_F=$RUN_D/smbd.pid SMBD_PID_F=$RUN_D/smbd.pid
[ -f $DEFAULT ] && . $DEFAULT [ -f $DEFAULT ] && . $DEFAULT
case $1 in start() {
start) mkdir -p $RUN_D
mkdir -p $RUN_D nmbd -D $NMBD_OPTIONS
nmbd -D $NMBD_OPTIONS smbd -D $SMBD_OPTIONS
smbd -D $SMBD_OPTIONS }
;; stop() {
stop) [ -f $SMBD_PID_F ] && kill $(cat $SMBD_PID_F)
[ -f $SMBD_PID_F ] && kill $(cat $SMBD_PID_F) [ -f $NMBD_PID_F ] && kill $(cat $NMBD_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
mkdir -p `grep "^scanlogd:" /etc/passwd | cut -d: -f6` # Copyright (C) 2006 OpenWrt.org
/usr/sbin/scanlogd
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 BIN=siproxd
DEFAULT=/etc/default/$BIN DEFAULT=/etc/default/$BIN
@ -6,16 +7,12 @@ RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid PID_F=$RUN_D/$BIN.pid
[ -f $DEFAULT ] && . $DEFAULT [ -f $DEFAULT ] && . $DEFAULT
case $1 in start() {
start) mkdir -p $RUN_D
mkdir -p $RUN_D $BIN $OPTIONS
$BIN $OPTIONS }
;;
stop) stop() {
[ -f $PID_F ] && kill $(cat $PID_F) [ -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
if [ -f /etc/srelay.conf ];then start() {
srelay -c /etc/srelay.conf -r -s if [ -f /etc/srelay.conf ];then
fi 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 BIN=tor
DEFAULT=/etc/default/$BIN DEFAULT=/etc/default/$BIN
@ -7,18 +8,13 @@ RUN_D=/var/run
PID_F=$RUN_D/$BIN.pid PID_F=$RUN_D/$BIN.pid
[ -f $DEFAULT ] && . $DEFAULT [ -f $DEFAULT ] && . $DEFAULT
case $1 in start() {
start) mkdir -p $LOG_D
mkdir -p $LOG_D mkdir -p $RUN_D
mkdir -p $RUN_D $BIN $OPTIONS
$BIN $OPTIONS }
;;
stop) stop() {
[ -f $PID_F ] && kill $(cat $PID_F) [ -f $PID_F ] && kill $(cat $PID_F)
;; }
*)
echo "usage: $0 (start|stop)"
exit 1
esac
exit $?

View File

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

View File

@ -1,13 +1,20 @@
#!/bin/sh #!/bin/sh /etc/rc.common
. /etc/nvram.sh # Copyright (C) 2006 OpenWrt.org
ddnsupdate=$(nvram get ddns_update) start() {
[ "$ddnsupdate" = 1 ]&& { . /etc/nvram.sh
service=$(nvram get ddns_service)
uname=$(nvram get ddns_user) ddnsupdate=$(nvram get ddns_update)
passwd=$(nvram get ddns_password) [ "$ddnsupdate" = 1 ]&& {
host=$(nvram get ddns_host) service=$(nvram get ddns_service)
uname=$(nvram get ddns_user)
/usr/bin/updatedd -Y $service -- $uname:$passwd $host passwd=$(nvram get ddns_password)
host=$(nvram get ddns_host)
/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 BIN=vrrpd
DEFAULT=/etc/default/$BIN DEFAULT=/etc/default/$BIN
@ -6,16 +7,11 @@ DEFAULT=/etc/default/$BIN
RUN_D=/var/run RUN_D=/var/run
PID_F=$RUN_D/$BIN_${IF}_${ID}.pid PID_F=$RUN_D/$BIN_${IF}_${ID}.pid
case $1 in start() {
start) $BIN $OPTIONS
$BIN $OPTIONS }
;;
stop) stop() {
[ -f $PID_F ] && kill $(cat $PID_F) >/dev/null 2>&1 [ -f $PID_F ] && kill $(cat $PID_F) >/dev/null 2>&1
;; }
*)
echo "usage: $0 (start|stop)"
exit 1
esac
exit $?

View File

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

View File

@ -1,3 +1,11 @@
#!/bin/sh #!/bin/sh /etc/rc.common
/usr/bin/wifidog-init start # 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 DEFAULT=/etc/default/xinetd
RUN_D=/var/run RUN_D=/var/run
PID_F=$RUN_D/xinetd.pid PID_F=$RUN_D/xinetd.pid
[ -f $DEFAULT ] && . $DEFAULT [ -f $DEFAULT ] && . $DEFAULT
case $1 in start() {
start) [ -d $RUN_D ] || mkdir -p $RUN_D
[ -d $RUN_D ] || mkdir -p $RUN_D xinetd $OPTIONS
xinetd $OPTIONS }
;;
stop) stop() {
[ -f $PID_F ] && kill $(cat $PID_F) [ -f $PID_F ] && kill $(cat $PID_F)
;; }
*)
echo "usage: $0 (start|stop)"
exit 1
esac
exit $?

View File

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