wok view at/stuff/atd @ rev 13701

Add get-xcas
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Dec 17 10:11:05 2012 +0100 (2012-12-17)
parents
children 7f188676b59c
line source
1 #!/bin/sh
2 # Start, stop and restart a atd deamon on SliTaz, at boot time or
3 # with the command line.
4 #
5 # To start daemon at boot time, just put the right name in the $RUN_DAEMONS
6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf.
7 #
8 . /etc/init.d/rc.functions
10 NAME=$(basename $0)
11 DESC="$NAME deamon"
12 DAEMON=$(which $NAME)
13 eval $(grep -i ^${NAME}_OPTIONS /etc/daemons.conf | sed 's/.*_OPT/OPT/')
14 PIDFILE=/var/run/$NAME.pid
16 case "$1" in
17 start)
18 if active_pidfile $PIDFILE $NAME ; then
19 echo "$NAME is already running."
20 exit 1
21 fi
22 echo -n "Starting $DESC: $NAME... "
23 $DAEMON $OPTIONS
24 [ -f $PIDFILE ] || pidof $NAME | awk '{ print $1 }' > $PIDFILE
25 active_pidfile $PIDFILE $NAME
26 status
27 ;;
28 stop)
29 if ! active_pidfile $PIDFILE $NAME ; then
30 echo "$NAME is not running."
31 exit 1
32 fi
33 echo -n "Stopping $DESC: $NAME... "
34 kill `cat $PIDFILE`
35 status
36 ;;
37 restart)
38 if ! active_pidfile $PIDFILE $NAME ; then
39 echo "$NAME is not running."
40 exit 1
41 fi
42 echo -n "Restarting $DESC: $NAME... "
43 kill `cat $PIDFILE`
44 sleep 2
45 $DAEMON $OPTIONS
46 [ -f $PIDFILE ] || pidof $NAME | awk '{ print $1 }' > $PIDFILE
47 active_pidfile $PIDFILE $NAME
48 status
49 ;;
50 *)
51 echo ""
52 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
53 echo ""
54 exit 1
55 ;;
56 esac
58 exit 0