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 / atd < prev    next >
Text File  |  2006-05-02  |  4KB  |  140 lines

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