updated on Thu Jan 19 20:01:47 UTC 2012
[aur-mirror.git] / rng-tools / rngd
blobe832f9becf1ad40f71fa427f96979c6727f0e8ef
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 rnd_device=/dev/random
7 rng_device=/dev/hw_random
8 timeout=0
10 [ -f /etc/conf.d/rngd ] && . /etc/conf.d/rngd
11 PID=$(pidof -o %PPID /usr/sbin/rngd)
12 case "$1" in
13 start)
14 stat_busy "Starting RNG"
15 [ -z "$PID" ] && /usr/sbin/rngd -o $rnd_device -r $rng_device -t $timeout
16 if [ $? -gt 0 ]; then
17 stat_fail
18 else
19 add_daemon rngd
20 stat_done
23 stop)
24 stat_busy "Stopping RNG"
25 [ ! -z "$PID" ] && kill $PID &> /dev/null
26 if [ $? -gt 0 ]; then
27 stat_fail
28 else
29 rm_daemon rngd
30 stat_done
31 fi
33 restart)
34 $0 stop
35 sleep 2
36 $0 start
39 echo "usage: $0 {start|stop|restart}"
40 esac
41 exit 0