wok-4.x annotate hal/stuff/etc/init.d/hald @ rev 792
Add hal - Hardware Abstraction Layer
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Thu May 15 20:48:24 2008 +0200 (2008-05-15) |
parents | |
children | f34a5fddcf70 |
rev | line source |
---|---|
pankso@792 | 1 #!/bin/sh |
pankso@792 | 2 # /etc/init.d/hald: Start, stop and restart HAL daemon on SliTaz, |
pankso@792 | 3 # at boot time or with the command line. Daemons options are configured |
pankso@792 | 4 # with /etc/daemons.conf |
pankso@792 | 5 # |
pankso@792 | 6 . /etc/init.d/rc.functions |
pankso@792 | 7 . /etc/daemons.conf |
pankso@792 | 8 |
pankso@792 | 9 NAME=HAL |
pankso@792 | 10 DESC="Hardware Abstraction Layer" |
pankso@792 | 11 DAEMON=/usr/sbin/hald |
pankso@792 | 12 OPTIONS=$HALD_OPTIONS |
pankso@792 | 13 PIDFILE=/var/run/hald/pid |
pankso@792 | 14 |
pankso@792 | 15 case "$1" in |
pankso@792 | 16 start) |
pankso@792 | 17 if [ -f $PIDFILE ] ; then |
pankso@792 | 18 echo "$NAME already running." |
pankso@792 | 19 exit 1 |
pankso@792 | 20 fi |
pankso@792 | 21 echo -n "Starting $DESC: $NAME... " |
pankso@792 | 22 $DAEMON $OPTIONS |
pankso@792 | 23 status |
pankso@792 | 24 ;; |
pankso@792 | 25 stop) |
pankso@792 | 26 if [ ! -f $PIDFILE ] ; then |
pankso@792 | 27 echo "$NAME is not running." |
pankso@792 | 28 exit 1 |
pankso@792 | 29 fi |
pankso@792 | 30 echo -n "Stopping $DESC: $NAME... " |
pankso@792 | 31 kill `cat $PIDFILE` |
pankso@792 | 32 rm $PIDFILE |
pankso@792 | 33 status |
pankso@792 | 34 ;; |
pankso@792 | 35 restart) |
pankso@792 | 36 if [ ! -f $PIDFILE ] ; then |
pankso@792 | 37 echo "$NAME is not running." |
pankso@792 | 38 exit 1 |
pankso@792 | 39 fi |
pankso@792 | 40 echo -n "Restarting $DESC: $NAME... " |
pankso@792 | 41 kill `cat $PIDFILE` |
pankso@792 | 42 rm $PIDFILE |
pankso@792 | 43 sleep 2 |
pankso@792 | 44 $DAEMON $OPTIONS |
pankso@792 | 45 status |
pankso@792 | 46 ;; |
pankso@792 | 47 *) |
pankso@792 | 48 echo "" |
pankso@792 | 49 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" |
pankso@792 | 50 echo "" |
pankso@792 | 51 exit 1 |
pankso@792 | 52 ;; |
pankso@792 | 53 esac |
pankso@792 | 54 |
pankso@792 | 55 exit 0 |