summaryrefslogtreecommitdiffstats
path: root/source/a/dcron/rc.crond
blob: d9076b330b8d03340a11f0dec534175899f51d10 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
# /etc/rc.d/rc.crond - start/stop the cron daemon

# To change the default options, edit /etc/default/crond.
if [ -r /etc/default/crond ]; then
  . /etc/default/crond
fi

start_crond() {
  if ! /usr/bin/pgrep --ns $$ --euid root -f "^/usr/sbin/crond" 1> /dev/null 2> /dev/null ; then
    echo "Starting crond:  /usr/sbin/crond $CROND_OPTS"
    mkdir -p /run/cron
    /usr/sbin/crond $CROND_OPTS
  fi
}

stop_crond() {
  echo "Stopping crond."
  /usr/bin/pkill --ns $$ --euid root -f "^/usr/sbin/crond" 2> /dev/null 
}

restart_crond() {
  stop_crond
  sleep 1
  start_crond
}

case "$1" in
'start')
  start_crond
  ;;
'stop')
  stop_crond
  ;;
'restart')
  restart_crond
  ;;
*)
  echo "usage $0 start|stop|restart"
esac