wok-current annotate at/stuff/atd @ rev 21672

updated peazip (6.4.1 -> 6.8.0)
author Hans-G?nter Theisgen
date Sat Jun 01 15:46:50 2019 +0100 (2019-06-01)
parents 7f188676b59c
children
rev   line source
slaxemulator@10992 1 #!/bin/sh
al@19161 2 # Start, stop and restart a atd daemon on SliTaz, at boot time or
slaxemulator@10992 3 # with the command line.
slaxemulator@10992 4 #
slaxemulator@10992 5 # To start daemon at boot time, just put the right name in the $RUN_DAEMONS
slaxemulator@10992 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf.
slaxemulator@10992 7 #
slaxemulator@10992 8 . /etc/init.d/rc.functions
slaxemulator@10992 9
slaxemulator@10992 10 NAME=$(basename $0)
al@19159 11 DESC="$(_ '%s daemon' $NAME)"
slaxemulator@10992 12 DAEMON=$(which $NAME)
slaxemulator@10992 13 eval $(grep -i ^${NAME}_OPTIONS /etc/daemons.conf | sed 's/.*_OPT/OPT/')
slaxemulator@10992 14 PIDFILE=/var/run/$NAME.pid
slaxemulator@10992 15
slaxemulator@10992 16 case "$1" in
slaxemulator@10992 17 start)
slaxemulator@10992 18 if active_pidfile $PIDFILE $NAME ; then
al@19159 19 _ '%s is already running.' $NAME
slaxemulator@10992 20 exit 1
slaxemulator@10992 21 fi
al@19159 22 action 'Starting %s: %s...' "$DESC" $NAME
al@19159 23 $DAEMON $OPTIONS
al@19159 24 [ -f $PIDFILE ] || pidof $NAME | awk '{print $1}' > $PIDFILE
slaxemulator@10992 25 active_pidfile $PIDFILE $NAME
slaxemulator@10992 26 status
slaxemulator@10992 27 ;;
slaxemulator@10992 28 stop)
slaxemulator@10992 29 if ! active_pidfile $PIDFILE $NAME ; then
al@19159 30 _ '%s is not running.' $NAME
slaxemulator@10992 31 exit 1
slaxemulator@10992 32 fi
al@19159 33 action 'Stopping %s: %s...' "$DESC" $NAME
al@19159 34 kill $(cat $PIDFILE)
slaxemulator@10992 35 status
slaxemulator@10992 36 ;;
slaxemulator@10992 37 restart)
slaxemulator@10992 38 if ! active_pidfile $PIDFILE $NAME ; then
al@19159 39 _ '%s is not running.' $NAME
slaxemulator@10992 40 exit 1
slaxemulator@10992 41 fi
al@19159 42 action 'Restarting %s: %s...' "$DESC" $NAME
al@19159 43 kill $(cat $PIDFILE)
slaxemulator@10992 44 sleep 2
slaxemulator@10992 45 $DAEMON $OPTIONS
al@19159 46 [ -f $PIDFILE ] || pidof $NAME | awk '{print $1}' > $PIDFILE
slaxemulator@10992 47 active_pidfile $PIDFILE $NAME
slaxemulator@10992 48 status
slaxemulator@10992 49 ;;
al@19159 50 *)
al@19159 51 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
al@19159 52 newline
slaxemulator@10992 53 exit 1
slaxemulator@10992 54 ;;
slaxemulator@10992 55 esac
slaxemulator@10992 56
slaxemulator@10992 57 exit 0