3 # random Script to snapshot random state and reload it at boot time.
5 # chkconfig: 12345 20 80
7 # description: Saves and restores system entropy pool for higher quality \
8 # random number generation.
10 # $Id: random,v 1.6 2000/11/16 16:01:18 baggins Exp $
13 NLS_DOMAIN="rc-scripts"
15 # Source function library.
16 . /etc/rc.d/init.d/functions
18 random_seed=/var/run/random-seed
20 # See how we were called.
23 show "Initializing random number generator"
25 # Carry a random seed from start-up to start-up
26 # Load and then save 512 bytes, which is the size of the entropy pool
27 if [ -f $random_seed ]; then
28 cat $random_seed >/dev/urandom
32 chmod 600 $random_seed
33 dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null
34 touch /var/lock/subsys/random
39 # Carry a random seed from shut-down to start-up
40 # Save 512 bytes, which is the size of the entropy pool
41 show "Saving random seed"
44 chmod 600 $random_seed
45 dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null
47 rm -f /var/lock/subsys/random
52 # this is way overkill, but at least we have some status output...
53 if [ -c /dev/random ] ; then
54 nls "The random data source exists"
56 nls "The random data source is missing"
60 # do not do anything; this is unreasonable
64 # do not advertise unreasonable commands that there is no reason
65 # to use with this device
66 echo "Usage: random {start|stop|status|restart|reload}"
72 # This must be last line !
73 # vi:syntax=sh:tw=78:ts=8:sw=4