summaryrefslogtreecommitdiffstats
path: root/source/ap/at/rc.atd
blob: fdc42d70b1e7fb0bb202d27a73785a7c72c4020c (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
#!/bin/sh
# /etc/rc.d/rc.atd - start/stop the at daemon

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

start_atd() {
  if ! /usr/bin/pgrep --ns $$ --exact atd 1> /dev/null 2> /dev/null ; then
    echo "Starting atd:  /usr/sbin/atd $ATD_OPTS"
    /usr/sbin/atd $ATD_OPTS
  fi
}

stop_atd() {
  echo "Stopping atd."
  /usr/bin/pkill --ns $$ --exact atd 2> /dev/null
}

restart_atd() {
  stop_atd
  sleep 1
  start_atd
}

case "$1" in
'start')
  start_atd
  ;;
'stop')
  stop_atd
  ;;
'restart')
  restart_atd
  ;;
*)
  echo "usage $0 start|stop|restart"
esac