Subversion Repositories configs

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 - 1
#!/bin/sh
2
#
3
# haldaemon:   HAL daemon
4
#
5
# chkconfig: 345 26 74
6
# description:  This is a daemon for collecting and maintaing information \
7
#               about hardware from several sources. \
8
#               See http://www.freedesktop.org/Software/hal
9
#
10
# processname: hald
11
# pidfile: /var/run/haldaemon.pid
12
#
13
 
14
# Source function library.
15
. /etc/rc.d/init.d/functions
16
 
17
# so we can rearrange this easily
18
processname=hald
19
servicename=haldaemon
20
 
21
if [ -f /etc/sysconfig/haldaemon ]; then
22
    HALD_ARGS=`cat /etc/sysconfig/haldaemon`
23
fi
24
RETVAL=0
25
 
26
#
27
# See how we were called.
28
#
29
 
30
check() {
31
	# Check that we're a privileged user
32
	[ `id -u` = 0 ] || exit 4
33
 
34
	# Check if hald is executable
35
	test -x /usr/sbin/hald || exit 5
36
}
37
 
38
start() {
39
 
40
	check
41
 
42
	# Check if it is already running
43
	if [ ! -f /var/lock/subsys/$servicename ]; then
44
		echo -n $"Starting HAL daemon: "
45
		daemon --check $servicename $processname $HALD_ARGS
46
		RETVAL=$?
47
		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$servicename
48
		echo
49
	fi
50
	return $RETVAL
51
}
52
 
53
stop() {
54
 
55
	check
56
 
57
	echo -n $"Stopping HAL daemon: "
58
	killproc $servicename -TERM
59
	RETVAL=$?
60
    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$servicename
61
	echo
62
	if [ $RETVAL -eq 0 ]; then
63
		rm -f /var/lock/subsys/$servicename
64
		rm -f /var/run/haldaemon.pid
65
	fi
66
	return $RETVAL
67
}
68
 
69
case "$1" in
70
start)
71
	start
72
	;;
73
stop)
74
	stop
75
	;;
76
reload)
77
	echo "$0: Unimplemented feature (hald does this automatically)."
78
	RETVAL=3
79
	;;
80
force-reload)
81
	echo "$0: Unimplemented feature."
82
	RETVAL=3
83
	;;
84
status)
85
	status -p /var/run/haldaemon.pid -l haldaemon $processname
86
	RETVAL=$?
87
	;;
88
restart)
89
	stop
90
	sleep 3
91
	start
92
	;;
93
try-restart|condrestart)
94
	if [ -f /var/lock/subsys/$servicename ]; then
95
		stop
96
		sleep 3
97
		start
98
	fi
99
	;;
100
*)
101
	echo $"Usage: $0 {start|stop|status|restart|condrestart}"
102
	RETVAL=2
103
esac
104
 
105
exit $RETVAL