]>
Commit | Line | Data |
---|---|---|
894c068d | 1 | #!/bin/sh |
2 | # | |
3 | # haldaemon HAL daemon | |
4 | # | |
ec3470fa | 5 | # chkconfig: 345 48 52 |
894c068d | 6 | # |
7 | # description: This is a daemon for collecting and maintaing information \ | |
8 | # about hardware from several sources. \ | |
3dc0f765 | 9 | # See http://www.freedesktop.org/wiki/Software/hal |
894c068d | 10 | # |
da5ea7a0 | 11 | # $Id$ |
894c068d | 12 | |
13 | ||
14 | # Source function library | |
15 | . /etc/rc.d/init.d/functions | |
16 | ||
fa9c4f00 | 17 | # Include debbuging statment |
18 | . /etc/sysconfig/hald | |
19 | ||
622812de | 20 | start() { |
fa9c4f00 | 21 | # First step: check for running messagebus service |
5e021f14 | 22 | if ! /sbin/service messagebus status >/dev/null 2>&1 ; then |
fa9c4f00 | 23 | msg_not_running messagebus |
a0143826 | 24 | return |
7ee869fa | 25 | fi |
622812de | 26 | |
a0143826 | 27 | # Check if the service is already running? |
894c068d | 28 | if [ -f /var/lock/subsys/haldaemon ]; then |
a0143826 ER |
29 | msg_already_running haldaemon |
30 | return | |
31 | fi | |
32 | ||
33 | msg_starting haldaemon | |
34 | # Syslog output | |
35 | if is_yes "$USE_SYSLOG"; then | |
36 | daemon /usr/sbin/hald --use-syslog | |
894c068d | 37 | else |
a0143826 ER |
38 | daemon /usr/sbin/hald |
39 | fi | |
40 | RETVAL=$? | |
41 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/haldaemon | |
42 | } | |
43 | ||
44 | stop() { | |
45 | if [ ! -f /var/lock/subsys/haldaemon ]; then | |
894c068d | 46 | msg_not_running haldaemon |
a0143826 | 47 | return |
894c068d | 48 | fi |
a0143826 ER |
49 | |
50 | # Stop daemons. | |
51 | msg_stopping haldaemon | |
52 | killproc hald | |
53 | rm -f /var/lock/subsys/haldaemon | |
622812de ER |
54 | } |
55 | ||
da5ea7a0 | 56 | condrestart() { |
a0143826 | 57 | if [ ! -f /var/lock/subsys/haldaemon ]; then |
da5ea7a0 ER |
58 | msg_not_running haldaemon |
59 | RETVAL=$1 | |
a0143826 | 60 | return |
da5ea7a0 | 61 | fi |
a0143826 ER |
62 | |
63 | stop | |
64 | start | |
da5ea7a0 ER |
65 | } |
66 | ||
67 | reload() { | |
a0143826 | 68 | if [ ! -f /var/lock/subsys/haldaemon ]; then |
da5ea7a0 ER |
69 | msg_not_running haldaemon |
70 | RETVAL=7 | |
a0143826 | 71 | return |
da5ea7a0 | 72 | fi |
a0143826 ER |
73 | |
74 | msg_reloading haldaemon | |
75 | killproc hald -HUP | |
76 | RETVAL=$? | |
da5ea7a0 ER |
77 | } |
78 | ||
f7a0165d ER |
79 | upstart_controlled |
80 | ||
622812de ER |
81 | # See how we were called. |
82 | case "$1" in | |
83 | start) | |
84 | start | |
85 | ;; | |
86 | stop) | |
87 | stop | |
894c068d | 88 | ;; |
89 | restart) | |
622812de ER |
90 | stop |
91 | start | |
894c068d | 92 | ;; |
da5ea7a0 ER |
93 | try-restart) |
94 | condrestart 0 | |
95 | ;; | |
622812de | 96 | reload|force-reload) |
da5ea7a0 | 97 | reload |
894c068d | 98 | ;; |
894c068d | 99 | status) |
b28a390a | 100 | status hald |
894c068d | 101 | RETVAL=$? |
102 | ;; | |
103 | *) | |
da5ea7a0 | 104 | msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}" |
894c068d | 105 | exit 3 |
106 | esac | |
107 | ||
108 | exit $RETVAL |