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 / nscd < prev    next >
Text File  |  2006-04-22  |  3KB  |  122 lines

  1. #! /bin/sh
  2. # Copyright (c) 1995-2004 SuSE Linux AG, Nuernberg, Germany.
  3. # Copyright (c) 2005 SUSE LINUX Products GmbH, Nuernberg, Germany.
  4. # All rights reserved.
  5. #
  6. # Author: Ruediger Oertel
  7. #         Thorsten Kukuk
  8. #
  9. # Please send feedback to http://www.suse.de/feedback
  10. #
  11. # init.d/nscd
  12. #
  13. #   and symbolic its link
  14. #
  15. # /usr/sbin/rcnscd
  16. #
  17. # System startup script for the NIS daemon
  18. #
  19. ### BEGIN INIT INFO
  20. # Provides: nscd
  21. # Required-Start: $remote_fs $time
  22. # Should-Start: $syslog $named winbind
  23. # Required-Stop:
  24. # Default-Start:  3 5
  25. # Default-Stop:   0 1 2 6
  26. # Description:    Start Name Service Cache Daemon
  27. ### END INIT INFO
  28.  
  29. # Source SuSE config
  30. . /etc/rc.status
  31.  
  32. NSCD_BIN=/usr/sbin/nscd
  33. test -x $NSCD_BIN || { echo "$NSCD_BIN not installed";
  34.     if [ "$1" = "stop" ]; then exit 0; else exit 5; fi; }
  35.  
  36. NSCD_CONFIG=/etc/nscd.conf
  37. test -r $NSCD_CONFIG || { echo "$NSCD_CONFIG not existing";
  38.     if [ "$1" = "stop" ]; then exit 0; else exit 6; fi; }
  39.  
  40. NSCD_PID=/var/run/nscd/nscd.pid
  41.  
  42. # Shell functions sourced from /etc/rc.status:
  43. #      rc_check         check and set local and overall rc status
  44. #      rc_status        check and set local and overall rc status
  45. #      rc_status -v     ditto but be verbose in local rc status
  46. #      rc_status -v -r  ditto and clear the local rc status
  47. #      rc_failed        set local and overall rc status to failed
  48. #      rc_reset         clear local rc status (overall remains)
  49. #      rc_exit          exit appropriate to overall rc status
  50.  
  51. # First reset status of this service
  52. rc_reset
  53.  
  54. # Return values acc. to LSB for all commands but status:
  55. # 0 - success
  56. # 1 - misc error
  57. # 2 - invalid or excess args
  58. # 3 - unimplemented feature (e.g. reload)
  59. # 4 - insufficient privilege
  60. # 5 - program not installed
  61. # 6 - program not configured
  62. #
  63.  
  64. case "$1" in
  65.     start)
  66.     echo -n "Starting Name Service Cache Daemon"
  67.     /sbin/startproc -p $NSCD_PID $NSCD_BIN
  68.     rc_status -v
  69.     ;;
  70.     stop)
  71.     echo -n "Shutting down Name Service Cache Daemon"
  72.     /sbin/killproc -p $NSCD_PID -TERM $NSCD_BIN
  73.     # if nscd does not run as root, it cannot remove this files:
  74.     rm -f /var/run/nscd/socket $NSCD_PID
  75.     rc_status -v
  76.     ;;
  77.     try-restart|condrestart)
  78.     ## RH has a similar command named condrestart.
  79.     if test "$1" = "condrestart"; then
  80.             echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
  81.     fi
  82.         $0 status
  83.         if test $? = 0; then
  84.                 $0 restart
  85.         else
  86.                 rc_reset        # Not running is not a failure.
  87.         fi
  88.         rc_status
  89.         ;;
  90.     restart)
  91.     ## Stop the service and regardless of whether it was
  92.     ## running or not, start it again.
  93.     $0 stop
  94.     $0 start
  95.     rc_status
  96.     ;;
  97.     force-reload)
  98.     echo "Reload Name Service Cache Daemon"
  99.     $0 try-restart
  100.     rc_status
  101.     ;;
  102.     reload)
  103.     # nscd does not support SIGHUP, so fail.
  104.     echo -n "Reload Name Service Cache Daemon"
  105.     rc_failed 3
  106.     rc_status -v
  107.     ;;
  108.     status)
  109.     echo -n "Checking for Name Service Cache Daemon: "
  110.     /sbin/checkproc -p $NSCD_PID $NSCD_BIN
  111.     rc_status -v
  112.     ;;
  113.     probe)
  114.     test $NSCD_CONFIG -nt $NSCD_PID && echo restart
  115.     ;;
  116.     *)
  117.     echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
  118.     exit 1
  119.     ;;
  120. esac
  121. rc_exit
  122.