wok-6.x view hal/stuff/etc/init.d/hald @ rev 17103
orc-dev: updated deps
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Aug 30 09:58:45 2014 +0000 (2014-08-30) |
parents | f34a5fddcf70 |
children | 7f188676b59c |
line source
1 #!/bin/sh
2 # /etc/init.d/hald: Start, stop and restart HAL daemon on SliTaz,
3 # at boot time or with the command line. Daemons options are configured
4 # with /etc/daemons.conf
5 #
6 . /etc/init.d/rc.functions
7 . /etc/daemons.conf
9 NAME=HAL
10 DESC="Hardware Abstraction Layer"
11 DAEMON=/usr/sbin/hald
12 OPTIONS=$HALD_OPTIONS
13 PIDFILE=/run/hald/pid
15 case "$1" in
16 start)
17 if active_pidfile $PIDFILE hald ; then
18 echo "$NAME already running."
19 exit 1
20 fi
21 echo -n "Starting $DESC: $NAME... "
22 mkdir -p $(dirname $PIDFILE)
23 $DAEMON $OPTIONS
24 status ;;
25 stop)
26 if ! active_pidfile $PIDFILE hald ; then
27 echo "$NAME is not running."
28 exit 1
29 fi
30 echo -n "Stopping $DESC: $NAME... "
31 kill $(cat $PIDFILE)
32 rm $PIDFILE
33 status ;;
34 restart)
35 if ! active_pidfile $PIDFILE hald ; then
36 echo "$NAME is not running."
37 exit 1
38 fi
39 echo -n "Restarting $DESC: $NAME... "
40 kill $(cat $PIDFILE)
41 rm $PIDFILE
42 sleep 2
43 $DAEMON $OPTIONS
44 status ;;
45 *)
46 echo ""
47 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
48 echo ""
49 exit 1 ;;
50 esac
52 exit 0