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.20120305.etc.tar.gz / bradford.20120305.etc.tar / etc / init.d / rpasswdd < prev    next >
Text File  |  2006-05-02  |  4KB  |  135 lines

  1. #! /bin/sh
  2. # Copyright (c) 2004 Thorsten Kukuk
  3. #
  4. # /etc/init.d/rpasswdd
  5. #
  6. #   and symbolic its link
  7. #
  8. # /usr/sbin/rcrpasswdd
  9. #
  10. # LSB compliant service control script; see http://www.linuxbase.org/spec/
  11. #
  12. # System startup script for the remote password update daemon
  13. #
  14. ### BEGIN INIT INFO
  15. # Provides: rpasswdd
  16. # Required-Start: $remote_fs $syslog
  17. # Required-Stop:  $remote_fs $syslog
  18. # Default-Start:  3 5
  19. # Default-Stop:   0 1 2 6
  20. # Description:    Start rpasswdd to allow secure remote password updates
  21. ### END INIT INFO
  22.  
  23. # Check for missing binaries (stale symlinks should not happen)
  24. RPASSWDD_BIN=/usr/sbin/rpasswdd
  25. test -x $RPASSWDD_BIN || exit 5
  26.  
  27. # Check for existence of needed config file and read it
  28. RPASSWDD_CONFIG=/etc/sysconfig/rpasswdd
  29. test -r $RPASSWDD_CONFIG && . $RPASSWDD_CONFIG
  30.  
  31. # Shell functions sourced from /etc/rc.status:
  32. #      rc_check         check and set local and overall rc status
  33. #      rc_status        check and set local and overall rc status
  34. #      rc_status -v     ditto but be verbose in local rc status
  35. #      rc_status -v -r  ditto and clear the local rc status
  36. #      rc_failed        set local and overall rc status to failed
  37. #      rc_failed <num>  set local and overall rc status to <num><num>
  38. #      rc_reset         clear local rc status (overall remains)
  39. #      rc_exit          exit appropriate to overall rc status
  40. #      rc_active    checks whether a service is activated by symlinks
  41. . /etc/rc.status
  42.  
  43. # First reset status of this service
  44. rc_reset
  45.  
  46. # Return values acc. to LSB for all commands but status:
  47. # 0 - success
  48. # 1 - generic or unspecified error
  49. # 2 - invalid or excess argument(s)
  50. # 3 - unimplemented feature (e.g. "reload")
  51. # 4 - insufficient privilege
  52. # 5 - program is not installed
  53. # 6 - program is not configured
  54. # 7 - program is not running
  55. #
  56. # Note that starting an already running service, stopping
  57. # or restarting a not-running service as well as the restart
  58. # with force-reload (in case signalling is not supported) are
  59. # considered a success.
  60.  
  61. case "$1" in
  62.     start)
  63.     echo -n "Starting rpasswd daemon"
  64.     if [ ! -f /etc/rpasswdd.pem ] ; then
  65.       echo -n " . . . . . . . . . . No certificate found"
  66.           rc_status -s
  67.           # service is not configured
  68.           rc_failed 6
  69.           rc_exit
  70.         fi
  71.     startproc $RPASSWDD_BIN $RPASSWDD_OPTIONS
  72.     rc_status -v
  73.     ;;
  74.     stop)
  75.     echo -n "Shutting down rpasswd daemon"
  76.     killproc -TERM $RPASSWDD_BIN
  77.     rc_status -v
  78.     ;;
  79.     try-restart)
  80.     ## Stop the service and if this succeeds (i.e. the
  81.     ## service was running before), start it again.
  82.     $0 status >/dev/null &&  $0 restart
  83.     rc_status
  84.     ;;
  85.     restart)
  86.     ## Stop the service and regardless of whether it was
  87.     ## running or not, start it again.
  88.     $0 stop
  89.     $0 start
  90.     rc_status
  91.     ;;
  92.     force-reload)
  93.     ## Signal the daemon to reload its config. Most daemons
  94.     ## do this on signal 1 (SIGHUP).
  95.     ## If it does not support it, restart.
  96.  
  97.     #echo -n "Reload service RPASSWDD"
  98.     ## if it supports it:
  99.     #killproc -HUP $RPASSWDD_BIN
  100.     #touch /var/run/RPASSWDD.pid
  101.     #rc_status -v
  102.  
  103.     ## Otherwise:
  104.     $0 stop  &&  $0 start
  105.     rc_status
  106.     ;;
  107.     reload)
  108.     ## Like force-reload, but if daemon does not support
  109.     ## signalling, do nothing (!)
  110.  
  111.     # If it supports signalling:
  112.     echo -n "Reload service rpasswd daemon"
  113.     #killproc -HUP $RPASSWDD_BIN
  114.     #touch /var/run/RPASSWDD.pid
  115.     #rc_status -v
  116.  
  117.     ## Otherwise if it does not support reload:
  118.     rc_failed 3
  119.     rc_status -v
  120.     ;;
  121.     status)
  122.     echo -n "Checking for service rpasswd daemon: "
  123.     checkproc $RPASSWDD_BIN
  124.     rc_status -v
  125.     ;;
  126.     probe)
  127.     test /etc/rpasswdd.pem -nt /var/run/rpasswd.pid && echo restart
  128.     ;;
  129.     *)
  130.     echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
  131.     exit 1
  132.     ;;
  133. esac
  134. rc_exit
  135.