wok 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 5c31ac1caa1a
children dac216ce48c5
files hal/stuff/etc/init.d/hald
line diff
     1.1 --- a/hal/stuff/etc/init.d/hald	Fri Jun 01 18:10:20 2012 +0200
     1.2 +++ b/hal/stuff/etc/init.d/hald	Fri Jun 01 22:32:11 2012 +0200
     1.3 @@ -10,46 +10,43 @@
     1.4  DESC="Hardware Abstraction Layer"
     1.5  DAEMON=/usr/sbin/hald
     1.6  OPTIONS=$HALD_OPTIONS
     1.7 -PIDFILE=/var/run/hald/pid
     1.8 +PIDFILE=/run/hald/pid
     1.9  
    1.10  case "$1" in
    1.11 -  start)
    1.12 -    if active_pidfile $PIDFILE hald ; then
    1.13 -      echo "$NAME already running."
    1.14 -      exit 1
    1.15 -    fi
    1.16 -    echo -n "Starting $DESC: $NAME... "
    1.17 -    $DAEMON $OPTIONS
    1.18 -    status
    1.19 -    ;;
    1.20 -  stop)
    1.21 -    if ! active_pidfile $PIDFILE hald ; then
    1.22 -      echo "$NAME is not running."
    1.23 -      exit 1
    1.24 -    fi
    1.25 -    echo -n "Stopping $DESC: $NAME... "
    1.26 -    kill `cat $PIDFILE`
    1.27 -    rm $PIDFILE
    1.28 -    status
    1.29 -    ;;
    1.30 -  restart)
    1.31 -    if ! active_pidfile $PIDFILE hald ; then
    1.32 -      echo "$NAME is not running."
    1.33 -      exit 1
    1.34 -    fi
    1.35 -    echo -n "Restarting $DESC: $NAME... "
    1.36 -    kill `cat $PIDFILE`
    1.37 -    rm $PIDFILE
    1.38 -    sleep 2
    1.39 -    $DAEMON $OPTIONS
    1.40 -    status
    1.41 -    ;;
    1.42 -  *)
    1.43 -    echo ""
    1.44 -    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
    1.45 -    echo ""
    1.46 -    exit 1
    1.47 -    ;;
    1.48 +	start)
    1.49 +		if active_pidfile $PIDFILE hald ; then
    1.50 +			echo "$NAME already running."
    1.51 +			exit 1
    1.52 +		fi
    1.53 +		echo -n "Starting $DESC: $NAME... "
    1.54 +		mkdir -p $(dirname $PIDFILE)
    1.55 +		$DAEMON $OPTIONS
    1.56 +		status ;;
    1.57 +	stop)
    1.58 +		if ! active_pidfile $PIDFILE hald ; then
    1.59 +			echo "$NAME is not running."
    1.60 +			exit 1
    1.61 +		fi
    1.62 +		echo -n "Stopping $DESC: $NAME... "
    1.63 +		kill $(cat $PIDFILE)
    1.64 +		rm $PIDFILE
    1.65 +		status ;;
    1.66 +	restart)
    1.67 +		if ! active_pidfile $PIDFILE hald ; then
    1.68 +			echo "$NAME is not running."
    1.69 +			exit 1
    1.70 +		fi
    1.71 +		echo -n "Restarting $DESC: $NAME... "
    1.72 +		kill $(cat $PIDFILE)
    1.73 +		rm $PIDFILE
    1.74 +		sleep 2
    1.75 +		$DAEMON $OPTIONS
    1.76 +		status ;;
    1.77 +	*)
    1.78 +		echo ""
    1.79 +		echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
    1.80 +		echo ""
    1.81 +		exit 1 ;;
    1.82  esac
    1.83  
    1.84  exit 0