summaryrefslogtreecommitdiff
path: root/package/hal/S98haldaemon
blob: 40ea0f4d34cad3622c5720367f3e07d8b7fe2ab6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
#
# haldaemon:   HAL daemon
#
# chkconfig: 345 98 02
# description:  This is a daemon for collecting and maintaing information \
#               about hardware from several sources. \
#               See http://www.freedesktop.org/Software/hal
#
# processname: hald
# pidfile: /var/run/haldaemon.pid
#

# Sanity checks.
[ -x /usr/sbin/hald ] || exit 0

RETVAL=0

start() {
    echo -n "Starting HAL daemon: "
    hald
    RETVAL=$?
    echo "done"
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/haldaemon
}

stop() {
    echo -n "Stopping HAL daemon: "

    killall hald
    RETVAL=$?
    echo "done"
    if [ $RETVAL -eq 0 ]; then
        rm -f /var/lock/subsys/haldaemon
        rm -f /var/run/haldaemon.pid
    fi
}

# See how we were called.
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        stop
	sleep 3
        start
        ;;
    *)
        echo $"Usage: $0 {start|stop|restart}"
        ;;
esac
exit $RETVAL