summaryrefslogtreecommitdiffstats
path: root/spampd/rc-script
blob: 7c4b0591b16192f191d04ddaa6f680ebdd7ed7dd (plain)
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
41
42
43
44
#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/spampd

start() {
  stat_busy "Starting Spampd"
  su -l spampd -c "/usr/bin/spampd $ARGS"
  if [ $? -gt 0 ]; then
    stat_fail
  else
    add_daemon spampd
    stat_done
  fi
}

stop() {
  stat_busy "Stopping Spampd"
  kill $(cat /home/spampd/spampd.pid)
  if [ $? -gt 0 ]; then
    stat_fail
  else
    rm_daemon spampd
    stat_done
  fi
}

case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart)
    # calling 'stop' and 'start' without the $0 fails...
    $0 stop
    $0 start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"
esac
exit 0