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.20110725.etc.tar.gz / bradford.20110725.etc.tar / etc / init.d / saslauthd < prev    next >
Text File  |  2006-06-02  |  4KB  |  145 lines

  1. #! /bin/sh
  2. # Copyright (c) 2002 SuSE Linux AG Nuernberg, Germany.
  3. #
  4. # Author: Carsten Hoeger <choeger@suse.de>
  5. #
  6. # /etc/init.d/saslauthd
  7. #
  8. ### BEGIN INIT INFO
  9. # Provides:       saslauthd
  10. # Required-Start: $network
  11. # Required-Stop:
  12. # Default-Start:  3 5
  13. # Default-Stop:
  14. # Description:    start the cyrus-sasl2 auth daemon
  15. ### END INIT INFO
  16.  
  17.  
  18. AUTHD_BIN=/usr/sbin/saslauthd
  19. test -x $AUTHD_BIN || exit 5
  20.  
  21. SASLAUTHD_AUTHMECH=pam
  22. test -f /etc/sysconfig/saslauthd && . /etc/sysconfig/saslauthd
  23.  
  24. # Shell functions sourced from /etc/rc.status:
  25. #      rc_check         check and set local and overall rc status
  26. #      rc_status        check and set local and overall rc status
  27. #      rc_status -v     ditto but be verbose in local rc status
  28. #      rc_status -v -r  ditto and clear the local rc status
  29. #      rc_failed        set local and overall rc status to failed
  30. #      rc_failed <num>  set local and overall rc status to <num><num>
  31. #      rc_reset         clear local rc status (overall remains)
  32. #      rc_exit          exit appropriate to overall rc status
  33. . /etc/rc.status
  34.  
  35. # First reset status of this service
  36. rc_reset
  37.  
  38. # Return values acc. to LSB for all commands but status:
  39. # 0 - success
  40. # 1 - generic or unspecified error
  41. # 2 - invalid or excess argument(s)
  42. # 3 - unimplemented feature (e.g. "reload")
  43. # 4 - insufficient privilege
  44. # 5 - program is not installed
  45. # 6 - program is not configured
  46. # 7 - program is not running
  47. # Note that starting an already running service, stopping
  48. # or restarting a not-running service as well as the restart
  49. # with force-reload (in case signalling is not supported) are
  50. # considered a success.
  51.  
  52. case "$1" in
  53.     start)
  54.         echo -n "Starting service saslauthd"
  55.     ## Start daemon with startproc(8). If this fails
  56.     ## the echo return value is set appropriate.
  57.  
  58.     # NOTE: startproc return 0, even if service is 
  59.     # already running to match LSB spec.
  60.         /sbin/startproc $AUTHD_BIN -a $SASLAUTHD_AUTHMECH > /dev/null 2>&1
  61.  
  62.     # Remember status and be verbose
  63.     rc_status -v
  64.         ;;
  65.     stop)
  66.         echo -n "Shutting down service saslauthd"
  67.     ## Stop daemon with killproc(8) and if this fails
  68.     ## set echo the echo return value.
  69.  
  70.         /sbin/killproc -TERM $AUTHD_BIN > /dev/null 2>&1
  71.  
  72.     # Remember status and be verbose
  73.     rc_status -v
  74.         ;;
  75.     try-restart)
  76.     ## Stop the service and if this succeeds (i.e. the 
  77.     ## service was running before), start it again.
  78.     ## Note: try-restart is not (yet) part of LSB (as of 0.7.5)
  79.     $0 status >/dev/null &&  $0 restart
  80.  
  81.     # Remember status and be quiet
  82.     rc_status
  83.     ;;
  84.     restart)
  85.     ## Stop the service and regardless of whether it was
  86.     ## running or not, start it again.
  87.     $0 stop
  88.     $0 start
  89.  
  90.     # Remember status and be quiet
  91.     rc_status
  92.         ;;
  93.     force-reload)
  94.     ## Signal the daemon to reload its config. Most daemons
  95.     ## do this on signal 1 (SIGHUP).
  96.     ## If it does not support it, restart.
  97.  
  98.     echo -n "Reload service saslauthd"
  99.     ## if it supports it:
  100.     #/sbin/killproc -HUP $AUTHD_BIN
  101.     #touch /var/run/FOO.pid
  102.     #rc_status -v
  103.  
  104.     # Otherwise:
  105.     $0 stop  &&  $0 start
  106.     rc_status
  107.     ;;
  108.     reload)
  109.     ## Like force-reload, but if daemon does not support
  110.     ## signalling, do nothing (!)
  111.  
  112.     echo -n "Reload service saslauthd"
  113.     # If it supports signalling:
  114.     #/sbin/killproc -HUP $AUTHD_BIN
  115.     #touch /var/run/FOO.pid
  116.     #rc_status -v
  117.     
  118.     # Otherwise if it does not support reload:
  119.     rc_failed 3
  120.     rc_status -v
  121.         ;;
  122.     status)
  123.         echo -n "Checking for service saslauthd: "
  124.     ## Check status with checkproc(8), if process is running
  125.     ## checkproc will return with exit status 0.
  126.  
  127.     # Status has a slightly different for the status command:
  128.     # 0 - service running
  129.     # 1 - service dead, but /var/run/  pid  file exists
  130.     # 2 - service dead, but /var/lock/ lock file exists
  131.     # 3 - service not running
  132.  
  133.     # NOTE: checkproc returns LSB compliant status values.
  134.     /sbin/checkproc $AUTHD_BIN
  135.     rc_status -v
  136.         ;;
  137.     *)
  138.     echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
  139.         exit 1
  140.         ;;
  141. esac
  142. rc_exit
  143.  
  144.