wok annotate at/stuff/atd @ rev 12249
vte: save space on core and split python bindings in python-vte
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Mon Apr 09 19:03:43 2012 +0200 (2012-04-09) |
parents | |
children | 7f188676b59c |
rev | line source |
---|---|
slaxemulator@10992 | 1 #!/bin/sh |
slaxemulator@10992 | 2 # Start, stop and restart a atd deamon 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) |
slaxemulator@10992 | 11 DESC="$NAME deamon" |
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 |
slaxemulator@10992 | 19 echo "$NAME is already running." |
slaxemulator@10992 | 20 exit 1 |
slaxemulator@10992 | 21 fi |
slaxemulator@10992 | 22 echo -n "Starting $DESC: $NAME... " |
slaxemulator@10992 | 23 $DAEMON $OPTIONS |
slaxemulator@10992 | 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 |
slaxemulator@10992 | 30 echo "$NAME is not running." |
slaxemulator@10992 | 31 exit 1 |
slaxemulator@10992 | 32 fi |
slaxemulator@10992 | 33 echo -n "Stopping $DESC: $NAME... " |
slaxemulator@10992 | 34 kill `cat $PIDFILE` |
slaxemulator@10992 | 35 status |
slaxemulator@10992 | 36 ;; |
slaxemulator@10992 | 37 restart) |
slaxemulator@10992 | 38 if ! active_pidfile $PIDFILE $NAME ; then |
slaxemulator@10992 | 39 echo "$NAME is not running." |
slaxemulator@10992 | 40 exit 1 |
slaxemulator@10992 | 41 fi |
slaxemulator@10992 | 42 echo -n "Restarting $DESC: $NAME... " |
slaxemulator@10992 | 43 kill `cat $PIDFILE` |
slaxemulator@10992 | 44 sleep 2 |
slaxemulator@10992 | 45 $DAEMON $OPTIONS |
slaxemulator@10992 | 46 [ -f $PIDFILE ] || pidof $NAME | awk '{ print $1 }' > $PIDFILE |
slaxemulator@10992 | 47 active_pidfile $PIDFILE $NAME |
slaxemulator@10992 | 48 status |
slaxemulator@10992 | 49 ;; |
slaxemulator@10992 | 50 *) |
slaxemulator@10992 | 51 echo "" |
slaxemulator@10992 | 52 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" |
slaxemulator@10992 | 53 echo "" |
slaxemulator@10992 | 54 exit 1 |
slaxemulator@10992 | 55 ;; |
slaxemulator@10992 | 56 esac |
slaxemulator@10992 | 57 |
slaxemulator@10992 | 58 exit 0 |