Subversion Repositories configs

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 - 1
#!/bin/bash
2
#
3
# rngd        This starts and stops rngd
4
#
5
# chkconfig: - 13 99
6
# description: This starts the Random Number Generator Daemon, \
7
#              which collects entropy from hardware sources and \
8
#              write it to /dev/random
9
#
10
# processname: /sbin/rngd
11
# config: /etc/sysconfig/rngd
12
# pidfile: /var/run/rngd.pid
13
#
14
# Return values according to LSB for all commands but status:
15
# 0 - success
16
# 1 - generic or unspecified error
17
# 2 - invalid or excess argument(s)
18
# 3 - unimplemented feature (e.g. "reload")
19
# 4 - insufficient privilege
20
# 5 - program is not installed
21
# 6 - program is not configured
22
# 7 - program is not running
23
#
24
 
25
 
26
PATH=/sbin:/bin:/usr/bin:/usr/sbin
27
prog="rngd"
28
 
29
# Source function library.
30
. /etc/init.d/functions
31
 
32
# Allow anyone to run status
33
if [ "$1" = "status" ] ; then
34
	status $prog
35
	RETVAL=$?
36
	exit $RETVAL
37
fi
38
 
39
# Check that we are root ... so non-root users stop here
40
test $EUID = 0  ||  exit 4
41
 
42
# Check config
43
test -f /etc/sysconfig/rngd && . /etc/sysconfig/rngd
44
 
45
RETVAL=0
46
 
47
start(){
48
	test -x /sbin/rngd  || exit 5
49
 
50
	echo -n $"Starting $prog: "
51
 
52
	unset HOME MAIL USER USERNAME
53
	daemon $prog "$EXTRAOPTIONS"
54
	RETVAL=$?
55
	echo
56
	if test $RETVAL = 0 ; then
57
		touch /var/lock/subsys/rngd
58
	fi
59
	return $RETVAL
60
}
61
 
62
stop(){
63
	echo -n $"Stopping $prog: "
64
	killproc $prog
65
	RETVAL=$?
66
	echo
67
	rm -f /var/lock/subsys/rngd
68
	return $RETVAL
69
}
70
 
71
reload(){
72
	stop
73
	start
74
}
75
 
76
restart(){
77
	stop
78
	start
79
}
80
 
81
condrestart(){
82
	[ -e /var/lock/subsys/rngd ] && restart
83
	return 0
84
}
85
 
86
 
87
# See how we were called.
88
case "$1" in
89
    start)
90
	start
91
	;;
92
    stop)
93
	stop
94
	;;
95
    restart)
96
	restart
97
	;;
98
    reload|force-reload)
99
	reload
100
	;;
101
    condrestart|try-restart)
102
	condrestart
103
	;;
104
    *)
105
	echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
106
	RETVAL=3
107
esac
108
 
109
exit $RETVAL
110