home *** CD-ROM | disk | FTP | other *** search
/ chilidog.highland.cc.ks.us / chilidog.highland.cc.ks.us.zip / chilidog.highland.cc.ks.us / backup / bradford.20120521.etc.tar.gz / bradford.20120521.etc.tar / etc / init.d / random < prev    next >
Text File  |  2003-09-01  |  2KB  |  68 lines

  1. #! /bin/sh
  2. # Copyright (c) 1998-2002 SuSE Linux AG, Nuernberg, Germany.
  3. # All rights reserved.
  4. #
  5. # Author: Burchard Steinbild, 1998
  6. #         originally from Theodore Ts'o <tytso@mit.edu>
  7. #
  8. # Please send feedback to http://www.suse.de/feedback
  9. #
  10. # /etc/init.d/random
  11. #
  12. # Script to snapshot random state and reload it at boot time.
  13. #
  14. # Saves and restores system entropy pool for higher quality
  15. # random number generation.
  16. #
  17. ### BEGIN INIT INFO
  18. # Provides:       random
  19. # Required-Start:
  20. # Required-Stop:
  21. # Default-Start:  2 3 5
  22. # Default-Stop:
  23. # Description:    Script to snapshot random state and reload it at boot time.
  24. ### END INIT INFO
  25.  
  26. . /etc/rc.status
  27.  
  28. random_seed=/var/lib/misc/random-seed
  29.  
  30. rc_reset
  31. case "$1" in
  32.     start)
  33.         echo -n "Initializing random number generator"
  34.         # Carry a random seed from start-up to start-up
  35.         # Load and then save 512 bytes, which is the size of the entropy pool
  36.         if test -f $random_seed ; then
  37.                 cat $random_seed > /dev/urandom
  38.         rc_status
  39.         else
  40.                 > $random_seed
  41.         rc_status
  42.         fi
  43.         chmod 600 $random_seed
  44.         dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null
  45.     rc_status -v
  46.     ;;
  47.     stop)
  48.         # Carry a random seed from shut-down to start-up
  49.         # Save 512 bytes, which is the size of the entropy pool
  50.         echo -n "Saving random seed"
  51.         if test ! -f $random_seed ; then
  52.                 > $random_seed
  53.         rc_status
  54.     fi
  55.         chmod 600 $random_seed
  56.         dd if=/dev/urandom of=$random_seed count=1 bs=512 2>/dev/null
  57.     rc_status -v
  58.     ;;
  59.     status)
  60.     echo -n "Checking for random generator (always true)"
  61.     rc_status -v
  62.     ;;
  63.     *)
  64.     echo "Usage: $0 {start|stop|status}"
  65.     exit 1
  66. esac
  67. rc_exit
  68.