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 / cron < prev    next >
Text File  |  2006-08-25  |  4KB  |  158 lines

  1. #! /bin/sh
  2. # Copyright (c) 1995-2000 SuSE GmbH Nuernberg, Germany.
  3. #
  4. # Author: Werner Fink <werner@suse.de>, 1996-2001
  5. #
  6. # /etc/init.d/cron
  7. #
  8. #   and symbolic its link
  9. #
  10. # /usr/sbin/rccron
  11. #
  12. # System startup script for the cron daemon
  13. #
  14. ### BEGIN INIT INFO
  15. # Provides:       cron
  16. # Required-Start: $remote_fs $syslog $time
  17. # Should-Start:    $network sendmail postfix
  18. # Required-Stop:  $remote_fs $syslog
  19. # Default-Start:  2 3 5
  20. # Default-Stop:   0 1 6
  21. # Description:    Cron job service
  22. ### END INIT INFO
  23.  
  24. CRON_BIN=/usr/sbin/cron
  25. test -x $CRON_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. allow_deny_move_info() {
  56.     echo "WARNING: /var/spool/cron/allow and /var/spool/cron/deny have moved"
  57.     echo "to /etc/cron.allow and /etc/cron.deny."
  58.     echo "Please merge or move these files to get cron access rules restored."
  59. }
  60.  
  61. case "$1" in
  62.     start)
  63.         for al_de in {allow,deny}{,.rpmsave,.rpmorig} ; do
  64.         if [ -f /var/spool/cron/$al_de ] ; then
  65.             allow_deny_move_info
  66.             break
  67.         fi
  68.     done
  69.     echo -n "Starting CRON daemon"
  70.     ## Start daemon with startproc(8). If this fails
  71.     ## the echo return value is set appropriate.
  72.  
  73.     # NOTE: startproc return 0, even if service is 
  74.     # already running to match LSB spec.
  75.     startproc $CRON_BIN
  76.  
  77.     # Remember status and be verbose
  78.     rc_status -v
  79.     ;;
  80.     stop)
  81.     echo -n "Shutting down CRON daemon"
  82.     ## Stop daemon with killproc(8) and if this fails
  83.     ## set echo the echo return value.
  84.  
  85.     killproc -TERM $CRON_BIN
  86.  
  87.     # Remember status and be verbose
  88.     rc_status -v
  89.     ;;
  90.     try-restart)
  91.     ## Stop the service and if this succeeds (i.e. the 
  92.     ## service was running before), start it again.
  93.     ## Note: try-restart is not (yet) part of LSB (as of 0.7.5)
  94.     $0 status >/dev/null &&  $0 restart
  95.  
  96.     # Remember status and be quiet
  97.     rc_status
  98.     ;;
  99.     restart)
  100.     ## Stop the service and regardless of whether it was
  101.     ## running or not, start it again.
  102.     $0 stop
  103.     $0 start
  104.  
  105.     # Remember status and be quiet
  106.     rc_status
  107.     ;;
  108.     force-reload)
  109.     ## Signal the daemon to reload its config. Most daemons
  110.     ## do this on signal 1 (SIGHUP).
  111.     ## If it does not support it, restart.
  112.  
  113.     echo -n "Reload service Cron"
  114.     ## if it supports it:
  115.         ## cron monitors /etc/crontab  anyway
  116.     
  117.     checkproc $CRON_BIN
  118.     rc_status -v
  119.  
  120.     ## Otherwise:
  121.     #$0 stop  &&  $0 start
  122.     #rc_status
  123.     ;;
  124.     reload)
  125.     ## Like force-reload, but if daemon does not support
  126.     ## signalling, do nothing (!)
  127.  
  128.     ## Otherwise if it does not support reload:
  129.     rc_status -v
  130.     ;;
  131.     status)
  132.     echo -n "Checking for Cron: "
  133.     ## Check status with checkproc(8), if process is running
  134.     ## checkproc will return with exit status 0.
  135.  
  136.     # Status has a slightly different for the status command:
  137.     # 0 - service running
  138.     # 1 - service dead, but /var/run/  pid  file exists
  139.     # 2 - service dead, but /var/lock/ lock file exists
  140.     # 3 - service not running
  141.  
  142.     # NOTE: checkproc returns LSB compliant status values.
  143.     checkproc $CRON_BIN
  144.     rc_status -v
  145.     ;;
  146.     probe)
  147.     ## Optional: Probe for the necessity of a reload,
  148.     ## give out the argument which is required for a reload.
  149.  
  150.     ;;
  151.     *)
  152.     echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
  153.     exit 1
  154.     ;;
  155. esac
  156. rc_exit
  157.