wok annotate hal/stuff/etc/init.d/hald @ rev 12975
hal: create runtime dir
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Fri Jun 01 22:32:11 2012 +0200 (2012-06-01) |
parents | f34a5fddcf70 |
children | 7f188676b59c |
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@12975 | 13 PIDFILE=/run/hald/pid |
pankso@792 | 14 |
pankso@792 | 15 case "$1" in |
pankso@12975 | 16 start) |
pankso@12975 | 17 if active_pidfile $PIDFILE hald ; then |
pankso@12975 | 18 echo "$NAME already running." |
pankso@12975 | 19 exit 1 |
pankso@12975 | 20 fi |
pankso@12975 | 21 echo -n "Starting $DESC: $NAME... " |
pankso@12975 | 22 mkdir -p $(dirname $PIDFILE) |
pankso@12975 | 23 $DAEMON $OPTIONS |
pankso@12975 | 24 status ;; |
pankso@12975 | 25 stop) |
pankso@12975 | 26 if ! active_pidfile $PIDFILE hald ; then |
pankso@12975 | 27 echo "$NAME is not running." |
pankso@12975 | 28 exit 1 |
pankso@12975 | 29 fi |
pankso@12975 | 30 echo -n "Stopping $DESC: $NAME... " |
pankso@12975 | 31 kill $(cat $PIDFILE) |
pankso@12975 | 32 rm $PIDFILE |
pankso@12975 | 33 status ;; |
pankso@12975 | 34 restart) |
pankso@12975 | 35 if ! active_pidfile $PIDFILE hald ; then |
pankso@12975 | 36 echo "$NAME is not running." |
pankso@12975 | 37 exit 1 |
pankso@12975 | 38 fi |
pankso@12975 | 39 echo -n "Restarting $DESC: $NAME... " |
pankso@12975 | 40 kill $(cat $PIDFILE) |
pankso@12975 | 41 rm $PIDFILE |
pankso@12975 | 42 sleep 2 |
pankso@12975 | 43 $DAEMON $OPTIONS |
pankso@12975 | 44 status ;; |
pankso@12975 | 45 *) |
pankso@12975 | 46 echo "" |
pankso@12975 | 47 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" |
pankso@12975 | 48 echo "" |
pankso@12975 | 49 exit 1 ;; |
pankso@792 | 50 esac |
pankso@792 | 51 |
pankso@792 | 52 exit 0 |