diff options
Diffstat (limited to 'meta/recipes-extended/cronie/cronie/crond.init')
-rwxr-xr-x | meta/recipes-extended/cronie/cronie/crond.init | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/meta/recipes-extended/cronie/cronie/crond.init b/meta/recipes-extended/cronie/cronie/crond.init new file mode 100755 index 0000000000..050c37e453 --- /dev/null +++ b/meta/recipes-extended/cronie/cronie/crond.init | |||
@@ -0,0 +1,71 @@ | |||
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 | UID=`id -u` | ||
25 | |||
26 | case "$1" in | ||
27 | start) | ||
28 | if [ $UID -ne 0 ] ; then | ||
29 | echo "User has insufficient privilege." | ||
30 | exit 1 | ||
31 | fi | ||
32 | echo -n "Starting crond: " | ||
33 | start-stop-daemon --start --quiet --exec $CROND -- $CRONDARGS | ||
34 | RETVAL=$? | ||
35 | if [ $RETVAL -eq 0 ] ; then | ||
36 | echo "OK" | ||
37 | else | ||
38 | echo "FAIL" | ||
39 | fi | ||
40 | ;; | ||
41 | stop) | ||
42 | if [ $UID -ne 0 ] ; then | ||
43 | echo "User has insufficient privilege." | ||
44 | exit 1 | ||
45 | fi | ||
46 | echo -n "Stopping crond: " | ||
47 | start-stop-daemon --stop --quiet --pidfile /var/run/crond.pid | ||
48 | RETVAL=$? | ||
49 | if [ $RETVAL -eq 0 ] ; then | ||
50 | echo "OK" | ||
51 | else | ||
52 | echo "FAIL" | ||
53 | fi | ||
54 | ;; | ||
55 | status) | ||
56 | if [ -n "`/bin/pidof $CROND`" ] ; then | ||
57 | echo "crond is running." | ||
58 | else | ||
59 | echo "crond is not running." | ||
60 | fi | ||
61 | ;; | ||
62 | restart) | ||
63 | $0 stop && sleep 1 && $0 start | ||
64 | ;; | ||
65 | *) | ||
66 | echo "Usage: /etc/init.d/crond {start|stop|status|restart}" | ||
67 | exit 1 | ||
68 | esac | ||
69 | |||
70 | exit 0 | ||
71 | |||