Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | ### BEGIN INIT INFO |
| 3 | # Provides: crond crontab |
| 4 | # Default-Start: 2345 |
| 5 | # Default-Stop: 016 |
| 6 | # Short-Description: run cron daemon |
| 7 | # Description: cron is a standard UNIX program that runs user-specified |
| 8 | # programs at periodic scheduled times. vixie cron adds a |
| 9 | # number of features to the basic UNIX cron, including better |
| 10 | # security and more powerful configuration options. |
| 11 | ### END INIT INFO |
| 12 | |
| 13 | CROND=/usr/sbin/crond |
| 14 | CONFIG=/etc/sysconfig/crond |
| 15 | |
| 16 | [ -f $CONFIG ] || exit 1 |
| 17 | [ -x $CROND ] || exit 1 |
| 18 | |
| 19 | . $CONFIG |
| 20 | |
| 21 | # Source function library. |
| 22 | . /etc/init.d/functions |
| 23 | |
| 24 | case "$1" in |
| 25 | start) |
| 26 | echo -n "Starting crond: " |
| 27 | start-stop-daemon --start --quiet --exec $CROND -- $CRONDARGS |
| 28 | RETVAL=$? |
| 29 | if [ $RETVAL -eq 0 ] ; then |
| 30 | echo "OK" |
| 31 | else |
| 32 | echo "FAIL" |
| 33 | fi |
| 34 | ;; |
| 35 | stop) |
| 36 | echo -n "Stopping crond: " |
| 37 | start-stop-daemon --stop --quiet --pidfile /var/run/crond.pid |
| 38 | RETVAL=$? |
| 39 | if [ $RETVAL -eq 0 ] ; then |
| 40 | echo "OK" |
| 41 | else |
| 42 | echo "FAIL" |
| 43 | fi |
| 44 | ;; |
| 45 | status) |
| 46 | status crond |
| 47 | exit $? |
| 48 | ;; |
| 49 | restart) |
| 50 | $0 stop && sleep 1 && $0 start |
| 51 | ;; |
| 52 | *) |
| 53 | echo "Usage: /etc/init.d/crond {start|stop|status|restart}" |
| 54 | exit 1 |
| 55 | esac |
| 56 | |
| 57 | exit 0 |
| 58 | |