From: Felix Fietkau Date: Wed, 4 Oct 2006 21:04:48 +0000 (+0000) Subject: port over more init scripts X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=910f80e8afe066340faf304ba2aa75f60870c571;p=openwrt%2Fsvn-archive%2Fpackages.git port over more init scripts SVN-Revision: 4918 --- diff --git a/admin/monit/files/monit.init b/admin/monit/files/monit.init index 50b18de14..11eb30312 100644 --- a/admin/monit/files/monit.init +++ b/admin/monit/files/monit.init @@ -1,4 +1,5 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org BIN=monit DEFAULT=/etc/default/$BIN @@ -6,20 +7,12 @@ RUN_D=/var/run PID_F=$RUN_D/$BIN.pid [ -f $DEFAULT ] && . $DEFAULT -case $1 in - start) - mkdir -p $RUN_D - $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 $? +start() { + mkdir -p $RUN_D + $BIN $OPTIONS +} + +stop() { + [ -f $PID_F ] && kill $(cat $PID_F) +} + diff --git a/admin/osiris/files/osirisd.init b/admin/osiris/files/osirisd.init index 75904e349..0fc6e76c1 100644 --- a/admin/osiris/files/osirisd.init +++ b/admin/osiris/files/osirisd.init @@ -1,4 +1,5 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org BIN=osirisd DEFAULT=/etc/default/$BIN @@ -7,17 +8,12 @@ RUN_D=/var/run PID_F=$RUN_D/$BIN.pid [ -f $DEFAULT ] && . $DEFAULT -case $1 in - start) - mkdir -p $LIB_D - mkdir -p $RUN_D - $BIN $OPTIONS - ;; - stop) - [ -f $PID_F ] && kill $(cat $PID_F) - ;; - *) - echo "usage: $0 (start|stop)" - exit 1 -esac -exit $? +start() { + mkdir -p $LIB_D + mkdir -p $RUN_D + $BIN $OPTIONS +} +stop() { + [ -f $PID_F ] && kill $(cat $PID_F) +} + diff --git a/admin/syslog-ng/files/syslog-ng.init b/admin/syslog-ng/files/syslog-ng.init index 40472ed3b..238c11726 100755 --- a/admin/syslog-ng/files/syslog-ng.init +++ b/admin/syslog-ng/files/syslog-ng.init @@ -1,6 +1,7 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org -syslog_start() { +start() { [ -f /etc/syslog-ng/syslog-ng.conf ] || { echo "/etc/syslog-ng/syslog-ng.conf does not exist !"; exit 0; @@ -9,26 +10,17 @@ syslog_start() { [ -x /usr/sbin/syslog-ng ] && /usr/sbin/syslog-ng } -syslog_stop() { +stop() { killall syslog-ng } -case "$1" in - start) - syslog_start - ;; - stop) - syslog_stop - ;; - restart) - syslog_stop - sleep 1s - syslog_start - ;; - reload) +restart() { + stop + sleep 1 + start +} + +reload() { kill -HUP `cat /var/run/syslog-ng.pid` &>/dev/null - ;; - *) - echo "Usage: $0 " - ;; -esac +} + diff --git a/ipv6/mrd6/files/mrd6.init b/ipv6/mrd6/files/mrd6.init index 886723f15..9d6519949 100755 --- a/ipv6/mrd6/files/mrd6.init +++ b/ipv6/mrd6/files/mrd6.init @@ -1,29 +1,21 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org -case $1 in -start) - /sbin/lsmod | grep ipv6 > /dev/null - if [ "$?" != "0" ] - then - echo -n "IPv6 stack required by mrd6. Loading ipv6 module: " - /sbin/insmod ipv6 - echo "Done." - fi - echo -n "Starting IPv6 multicast router (mrd6): " +start() { + /sbin/lsmod | grep ipv6 > /dev/null + if [ "$?" != "0" ]; then + echo -n "IPv6 stack required by mrd6. Loading ipv6 module: " + /sbin/insmod ipv6 + echo "Done." + fi + echo -n "Starting IPv6 multicast router (mrd6): " /usr/sbin/mrd6 -f /etc/mrd6.conf -D - echo "Done." - ;; -stop) - echo -n "Stopping IPv6 multicast router (mrd6): " + echo "Done." +} + +stop() { + echo -n "Stopping IPv6 multicast router (mrd6): " killall mrd6 - echo "Done." - ;; -restart) - $0 stop - $0 start - ;; -*) - echo "Usage: $0 {start | stop | restart}" - ;; -esac -exit 0 + echo "Done." +} + diff --git a/libs/howl/files/mDNSResponder.init b/libs/howl/files/mDNSResponder.init index a3a575781..aae87c32d 100644 --- a/libs/howl/files/mDNSResponder.init +++ b/libs/howl/files/mDNSResponder.init @@ -1,4 +1,5 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org DEFAULT=/etc/default/mDNSResponder RUN_D=/var/run diff --git a/libs/net-snmp/files/snmpd.init b/libs/net-snmp/files/snmpd.init index 46b429760..42af3f7aa 100644 --- a/libs/net-snmp/files/snmpd.init +++ b/libs/net-snmp/files/snmpd.init @@ -1,4 +1,5 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org DEFAULT=/etc/default/snmpd LIB_D=/var/lib/snmp @@ -8,18 +9,14 @@ PID_F=$RUN_D/snmpd.pid [ -f $DEFAULT ] && . $DEFAULT -case $1 in - start) - [ -d $LIB_D ] || mkdir -p $LIB_D - [ -d $LOG_D ] || mkdir -p $LOG_D - [ -d $RUN_D ] || mkdir -p $RUN_D - snmpd $OPTIONS - ;; - stop) - [ -f $PID_F ] && kill $(cat $PID_F) - ;; - *) - echo "usage: $0 (start|stop)" - exit 1 -esac -exit $? +start() { + [ -d $LIB_D ] || mkdir -p $LIB_D + [ -d $LOG_D ] || mkdir -p $LOG_D + [ -d $RUN_D ] || mkdir -p $RUN_D + snmpd $OPTIONS +} + +stop() { + [ -f $PID_F ] && kill $(cat $PID_F) +} + diff --git a/multimedia/peercast/files/peercast.init b/multimedia/peercast/files/peercast.init index c61c31438..efe47ad46 100644 --- a/multimedia/peercast/files/peercast.init +++ b/multimedia/peercast/files/peercast.init @@ -1,18 +1,13 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org PID_F=/var/run/peercast.pid -case $1 in - start) - peercast -d -i /etc/peercast.ini -l /var/log/peercast.log -p $PID_F - ;; - stop) - [ -f $PID_F ] && kill $(cat $PID_F) >/dev/null 2>&1 - ;; - *) - echo "usage: $0 (start|stop)" - exit 1 -esac +start() { + peercast -d -i /etc/peercast.ini -l /var/log/peercast.log -p $PID_F +} -exit $? +stop() { + [ -f $PID_F ] && kill $(cat $PID_F) >/dev/null 2>&1 +} diff --git a/sound/mt-daapd/files/mt-daapd.init b/sound/mt-daapd/files/mt-daapd.init index 2968769c7..344621a41 100644 --- a/sound/mt-daapd/files/mt-daapd.init +++ b/sound/mt-daapd/files/mt-daapd.init @@ -1,4 +1,5 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org BIN=mt-daapd 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) - [ -d $RUN_D ] || mkdir -p $RUN_D - $BIN $OPTIONS - ;; - stop) - [ -f $PID_F ] && kill -INT $(cat $PID_F) - ;; - *) - echo "usage: $0 (start|stop)" - exit 1 -esac +start() { + [ -d $RUN_D ] || mkdir -p $RUN_D + $BIN $OPTIONS +} + +stop() { + [ -f $PID_F ] && kill -INT $(cat $PID_F) +} -exit $? diff --git a/utils/rrdcollect/files/rrdcollect.init b/utils/rrdcollect/files/rrdcollect.init index f9ee8bcaa..8fa4521cb 100644 --- a/utils/rrdcollect/files/rrdcollect.init +++ b/utils/rrdcollect/files/rrdcollect.init @@ -1,4 +1,5 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org BIN=rrdcollect DEFAULT=/etc/default/$BIN @@ -11,21 +12,16 @@ RRD_D=$LIB_D/rrd RRD_F=$(find $RRD_D -name "*.rrd" 2>/dev/null) [ -f $DEFAULT ] && . $DEFAULT -case $1 in - start) - mkdir -p $RUN_D - mkdir -p $IMG_D - mkdir -p $RRD_D - [ -n "$RRD_F" ] || /usr/bin/rrd.sh init - [ -x $CGI_S ] || /usr/bin/rrd.sh cgi - $BIN $OPTIONS - ;; - stop) - [ -f $PID_F ] && kill $(cat $PID_F) - ;; - *) - echo "usage: $0 (start|stop)" - exit 1 -esac +start() { + mkdir -p $RUN_D + mkdir -p $IMG_D + mkdir -p $RRD_D + [ -n "$RRD_F" ] || /usr/bin/rrd.sh init + [ -x $CGI_S ] || /usr/bin/rrd.sh cgi + $BIN $OPTIONS +} + +stop() { + [ -f $PID_F ] && kill $(cat $PID_F) +} -exit $? diff --git a/utils/setserial/files/serial.init b/utils/setserial/files/serial.init index ffd729e1e..77caae3a6 100644 --- a/utils/setserial/files/serial.init +++ b/utils/setserial/files/serial.init @@ -1,2 +1,6 @@ -#!/bin/sh -/usr/sbin/setserial /dev/tts/1 irq 3 +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +start() { + /usr/sbin/setserial /dev/tts/1 irq 3 +}