wok-6.x rev 5308

busybox: update init scripts
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Apr 20 18:23:21 2010 +0200 (2010-04-20)
parents 978886b83db3
children b1c80961bb47
files busybox/receipt busybox/stuff/daemon busybox/stuff/dnsd busybox/stuff/inetd busybox/stuff/udhcpd busybox/stuff/zcip
line diff
     1.1 --- a/busybox/receipt	Wed Apr 21 00:04:15 2010 +0000
     1.2 +++ b/busybox/receipt	Tue Apr 20 18:23:21 2010 +0200
     1.3 @@ -63,10 +63,10 @@
     1.4      cp stuff/udhcpd.conf $fs/etc
     1.5      touch $fs/etc/resolv.conf
     1.6      cp stuff/inetd.conf $fs/etc
     1.7 -    cp stuff/dnsd $fs/etc/init.d
     1.8 -    cp stuff/udhcpd $fs/etc/init.d
     1.9 -    cp stuff/inetd $fs/etc/init.d
    1.10 -    cp stuff/zcip $fs/etc/init.d
    1.11 +    cp stuff/daemon $fs/etc/init.d
    1.12 +    for i in dnsd inetd udhcpd zcip crond ; do
    1.13 +        ln -s daemon $fs/etc/init.d/$i 
    1.14 +    done
    1.15      cp stuff/init $fs
    1.16      rm $fs/linuxrc
    1.17      mkdir -p $fs/etc/modprobe.d
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/busybox/stuff/daemon	Tue Apr 20 18:23:21 2010 +0200
     2.3 @@ -0,0 +1,85 @@
     2.4 +#!/bin/sh
     2.5 +# Start, stop and restart a busybox deamon on SliTaz, at boot time or 
     2.6 +# with the command line.
     2.7 +#
     2.8 +# To start daemon at boot time, just put the right name in the $RUN_DAEMONS
     2.9 +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf.
    2.10 +#
    2.11 +. /etc/init.d/rc.functions
    2.12 +
    2.13 +NAME=$(basename $0)
    2.14 +DESC="$NAME deamon"
    2.15 +DAEMON=$(which $NAME)
    2.16 +eval $(grep -i ^${NAME}_OPTIONS /etc/daemons.conf | sed 's/.*_OPT/OPT/')
    2.17 +PIDFILE=/var/run/$NAME.pid
    2.18 +
    2.19 +active_inetd()
    2.20 +{
    2.21 +if grep $DAEMON /etc/inetd.conf | grep -q ^\#; then
    2.22 +    sed -i "s,^#\(.*$DAEMON.*\)$,\1," /etc/inetd.conf
    2.23 +    /etc/init.d/inetd stop > /dev/null
    2.24 +    exec /etc/init.d/inetd start
    2.25 +else
    2.26 +    echo "$NAME is already active."
    2.27 +    exit 1
    2.28 +fi
    2.29 +}
    2.30 +
    2.31 +inactive_inetd()
    2.32 +{
    2.33 +if grep $DAEMON /etc/inetd.conf | grep -q ^\#; then
    2.34 +    echo "$NAME is not active."
    2.35 +    exit 1
    2.36 +else
    2.37 +    sed -i "s,^.*$DAEMON.*$,#&," /etc/inetd.conf
    2.38 +    /etc/init.d/inetd stop > /dev/null
    2.39 +    exec /etc/init.d/inetd start
    2.40 +fi
    2.41 +}
    2.42 +
    2.43 +case "$1" in
    2.44 +  start)
    2.45 +    grep -qs $DAEMON /etc/inetd.conf && active_inetd
    2.46 +    if active_pidfile $PIDFILE $NAME ; then
    2.47 +      echo "$NAME is already running."
    2.48 +      exit 1
    2.49 +    fi
    2.50 +    echo -n "Starting $DESC: $NAME... "
    2.51 +    $DAEMON $OPTIONS 
    2.52 +    [ -f $PIDFILE ] || pidof $NAME | awk '{ print $1 }' > $PIDFILE
    2.53 +    active_pidfile $PIDFILE $NAME
    2.54 +    status
    2.55 +    ;;
    2.56 +  stop)
    2.57 +    grep -qs $DAEMON /etc/inetd.conf && inactive_inetd
    2.58 +    if ! active_pidfile $PIDFILE $NAME ; then
    2.59 +      echo "$NAME is not running."
    2.60 +      exit 1
    2.61 +    fi
    2.62 +    echo -n "Stopping $DESC: $NAME... "
    2.63 +    kill `cat $PIDFILE`
    2.64 +    status
    2.65 +    ;;
    2.66 +  restart)
    2.67 +    grep -qs $DAEMON /etc/inetd.conf && exit 0
    2.68 +    if ! active_pidfile $PIDFILE $NAME ; then
    2.69 +      echo "$NAME is not running."
    2.70 +      exit 1
    2.71 +    fi
    2.72 +    echo -n "Restarting $DESC: $NAME... "
    2.73 +    kill `cat $PIDFILE`
    2.74 +    sleep 2
    2.75 +    $DAEMON $OPTIONS
    2.76 +    [ -f $PIDFILE ] || pidof $NAME | awk '{ print $1 }' > $PIDFILE
    2.77 +    active_pidfile $PIDFILE $NAME
    2.78 +    status
    2.79 +    ;;
    2.80 +*)
    2.81 +    echo ""
    2.82 +    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
    2.83 +    echo ""
    2.84 +    exit 1
    2.85 +    ;;
    2.86 +esac
    2.87 +
    2.88 +exit 0
     3.1 --- a/busybox/stuff/dnsd	Wed Apr 21 00:04:15 2010 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,57 +0,0 @@
     3.4 -#!/bin/sh
     3.5 -# /etc/init.d/dnsd: Start, stop and restart DNS deamon on SliTaz, at boot
     3.6 -# time or with the command line.
     3.7 -#
     3.8 -# To start daemon at boot time, just put the right name in the $RUN_DAEMONS
     3.9 -# variable of /etc/rcS.conf and configure options with /etc/daemons.conf.
    3.10 -#
    3.11 -. /etc/init.d/rc.functions
    3.12 -. /etc/daemons.conf
    3.13 -
    3.14 -NAME=Dnsd
    3.15 -DESC="DNS deamon"
    3.16 -DAEMON=/usr/sbin/dnsd
    3.17 -OPTIONS=$DNSD_OPTIONS
    3.18 -PIDFILE=/var/run/dnsd.pid
    3.19 -
    3.20 -case "$1" in
    3.21 -  start)
    3.22 -    if active_pidfile $PIDFILE dnsd ; then
    3.23 -      echo "$NAME already running."
    3.24 -      exit 1
    3.25 -    fi
    3.26 -    echo -n "Starting $DESC: $NAME... "
    3.27 -    $DAEMON $OPTIONS && echo `pidof $DAEMON` > $PIDFILE
    3.28 -    status
    3.29 -    ;;
    3.30 -  stop)
    3.31 -    if ! active_pidfile $PIDFILE dnsd ; then
    3.32 -      echo "$NAME is not running."
    3.33 -      exit 1
    3.34 -    fi
    3.35 -    echo -n "Stopping $DESC: $NAME... "
    3.36 -    kill `cat $PIDFILE`
    3.37 -    rm $PIDFILE
    3.38 -    status
    3.39 -    ;;
    3.40 -  restart)
    3.41 -    if ! active_pidfile $PIDFILE dnsd ; then
    3.42 -      echo "$NAME is not running."
    3.43 -      exit 1
    3.44 -    fi
    3.45 -    echo -n "Restarting $DESC: $NAME... "
    3.46 -    kill `cat $PIDFILE`
    3.47 -    rm $PIDFILE
    3.48 -    sleep 2
    3.49 -    $DAEMON $OPTIONS
    3.50 -    status
    3.51 -    ;;
    3.52 -  *)
    3.53 -    echo ""
    3.54 -    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
    3.55 -    echo ""
    3.56 -    exit 1
    3.57 -    ;;
    3.58 -esac
    3.59 -
    3.60 -exit 0
     4.1 --- a/busybox/stuff/inetd	Wed Apr 21 00:04:15 2010 +0000
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,55 +0,0 @@
     4.4 -#!/bin/sh
     4.5 -# /etc/init.d/inetd: Start, stop and restart Inet deamon on SliTaz, at boot
     4.6 -# time or with the command line.
     4.7 -#
     4.8 -# To start daemon at boot time, just put the right name in the $RUN_DAEMONS
     4.9 -# variable of /etc/rcS.conf and configure options with /etc/daemons.conf.
    4.10 -#
    4.11 -. /etc/init.d/rc.functions
    4.12 -. /etc/daemons.conf
    4.13 -
    4.14 -NAME=Inetd
    4.15 -DESC="inetd deamon"
    4.16 -DAEMON=/usr/sbin/inetd
    4.17 -OPTIONS=$INETD_OPTIONS
    4.18 -PIDFILE=/var/run/inetd.pid
    4.19 -
    4.20 -case "$1" in
    4.21 -  start)
    4.22 -    if active_pidfile $PIDFILE inetd ; then
    4.23 -      echo "$NAME already running."
    4.24 -      exit 1
    4.25 -    fi
    4.26 -    echo -n "Starting $DESC: $NAME... "
    4.27 -    $DAEMON $OPTIONS 
    4.28 -    status
    4.29 -    ;;
    4.30 -  stop)
    4.31 -    if ! active_pidfile $PIDFILE inetd ; then
    4.32 -      echo "$NAME is not running."
    4.33 -      exit 1
    4.34 -    fi
    4.35 -    echo -n "Stopping $DESC: $NAME... "
    4.36 -    kill `cat $PIDFILE`
    4.37 -    status
    4.38 -    ;;
    4.39 -  restart)
    4.40 -    if ! active_pidfile $PIDFILE inetd ; then
    4.41 -      echo "$NAME is not running."
    4.42 -      exit 1
    4.43 -    fi
    4.44 -    echo -n "Restarting $DESC: $NAME... "
    4.45 -    kill `cat $PIDFILE`
    4.46 -    sleep 2
    4.47 -    $DAEMON $OPTIONS
    4.48 -    status
    4.49 -    ;;
    4.50 -  *)
    4.51 -    echo ""
    4.52 -    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
    4.53 -    echo ""
    4.54 -    exit 1
    4.55 -    ;;
    4.56 -esac
    4.57 -
    4.58 -exit 0
     5.1 --- a/busybox/stuff/udhcpd	Wed Apr 21 00:04:15 2010 +0000
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,57 +0,0 @@
     5.4 -#!/bin/sh
     5.5 -# /etc/init.d/udhcpd: Start, stop and restart Udhcp deamon on SliTaz, at boot
     5.6 -# time or with the command line.
     5.7 -#
     5.8 -# To start daemon at boot time, just put the right name in the $RUN_DAEMONS
     5.9 -# variable of /etc/rcS.conf and configure options with /etc/daemons.conf.
    5.10 -#
    5.11 -. /etc/init.d/rc.functions
    5.12 -. /etc/daemons.conf
    5.13 -
    5.14 -NAME=Udhcpd
    5.15 -DESC="udhcp deamon"
    5.16 -DAEMON=/usr/sbin/udhcpd
    5.17 -OPTIONS=$UDHCPD_OPTIONS
    5.18 -PIDFILE=/var/run/udhcpd.pid
    5.19 -
    5.20 -case "$1" in
    5.21 -  start)
    5.22 -    if active_pidfile $PIDFILE udhcpd ; then
    5.23 -      echo "$NAME already running."
    5.24 -      exit 1
    5.25 -    fi
    5.26 -    echo -n "Starting $DESC: $NAME... "
    5.27 -    $DAEMON $OPTIONS 
    5.28 -    status
    5.29 -    pidof udhcpd > $PIDFILE
    5.30 -    ;;
    5.31 -  stop)
    5.32 -    if ! active_pidfile $PIDFILE udhcpd ; then
    5.33 -      echo "$NAME is not running."
    5.34 -      exit 1
    5.35 -    fi
    5.36 -    echo -n "Stopping $DESC: $NAME... "
    5.37 -    kill `cat $PIDFILE`
    5.38 -    status
    5.39 -    ;;
    5.40 -  restart)
    5.41 -    if ! active_pidfile $PIDFILE udhcpd ; then
    5.42 -      echo "$NAME is not running."
    5.43 -      exit 1
    5.44 -    fi
    5.45 -    echo -n "Restarting $DESC: $NAME... "
    5.46 -    kill `cat $PIDFILE`
    5.47 -    sleep 2
    5.48 -    $DAEMON $OPTIONS
    5.49 -    status
    5.50 -    pidof udhcpd > $PIDFILE
    5.51 -    ;;
    5.52 -  *)
    5.53 -    echo ""
    5.54 -    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
    5.55 -    echo ""
    5.56 -    exit 1
    5.57 -    ;;
    5.58 -esac
    5.59 -
    5.60 -exit 0
     6.1 --- a/busybox/stuff/zcip	Wed Apr 21 00:04:15 2010 +0000
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,59 +0,0 @@
     6.4 -#!/bin/sh
     6.5 -# /etc/init.d/zcip: Start, stop and restart ZeroConf deamon on SliTaz, at boot
     6.6 -# time or with the command line.
     6.7 -#
     6.8 -# To start daemon at boot time, just put the right name in the $RUN_DAEMONS
     6.9 -# variable of /etc/rcS.conf and configure options with /etc/daemons.conf.
    6.10 -#
    6.11 -. /etc/init.d/rc.functions
    6.12 -. /etc/daemons.conf
    6.13 -. /etc/network.conf
    6.14 -
    6.15 -NAME=Zcip
    6.16 -DESC="ZeroConf deamon"
    6.17 -DAEMON=/sbin/zcip
    6.18 -OPTIONS=$ZCIP_OPTIONS
    6.19 -PIDFILE=/var/run/zcip.pid
    6.20 -[ -n "$OPTIONS" ] || OPTIONS="$INTERFACE /etc/zcip.script"
    6.21 -
    6.22 -case "$1" in
    6.23 -  start)
    6.24 -    if active_pidfile $PIDFILE zcip ; then
    6.25 -      echo "$NAME already running."
    6.26 -      exit 1
    6.27 -    fi
    6.28 -    echo -n "Starting $DESC: $NAME... "
    6.29 -    $DAEMON $OPTIONS && echo `pidof $DAEMON` > $PIDFILE
    6.30 -    status
    6.31 -    ;;
    6.32 -  stop)
    6.33 -    if ! active_pidfile $PIDFILE zcip ; then
    6.34 -      echo "$NAME is not running."
    6.35 -      exit 1
    6.36 -    fi
    6.37 -    echo -n "Stopping $DESC: $NAME... "
    6.38 -    kill `cat $PIDFILE`
    6.39 -    rm $PIDFILE
    6.40 -    status
    6.41 -    ;;
    6.42 -  restart)
    6.43 -    if ! active_pidfile $PIDFILE zcip ; then
    6.44 -      echo "$NAME is not running."
    6.45 -      exit 1
    6.46 -    fi
    6.47 -    echo -n "Restarting $DESC: $NAME... "
    6.48 -    kill `cat $PIDFILE`
    6.49 -    rm $PIDFILE
    6.50 -    sleep 2
    6.51 -    $DAEMON $OPTIONS
    6.52 -    status
    6.53 -    ;;
    6.54 -  *)
    6.55 -    echo ""
    6.56 -    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
    6.57 -    echo ""
    6.58 -    exit 1
    6.59 -    ;;
    6.60 -esac
    6.61 -
    6.62 -exit 0