summaryrefslogtreecommitdiff
path: root/network/exim/contrib/rc.exim.new
blob: 16d1ca71d0ba4610fd3ca252b02fc599a1cb1294 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh

# /etc/rc.d/rc.exim - start/stop/restart the exim mail transfer agent.
#
# Thales A. Tsailas <ttsailas@enforcingit.com>
# Thomas Morper <thomas@beingboiled.info>

PIDFILE=/var/run/exim.pid

# the TIME option causes Exim to run as a daemon, starting a queue runner 
# process at intervals specified by the given time value. (ie 5m, 1h etc).
TIME=15m

exim_start() {
  echo "Starting exim..."
  /usr/sbin/exim -bd ${TIME:+-q$TIME}
}

exim_stop() {
  echo "Shutting down exim..."
  killall exim
  rm -f $PIDFILE
}

exim_reload() {
  echo "Reloading exim configuration..."
  if [ -f $PIDFILE ]; then
    kill -HUP $(cat $PIDFILE)
  fi
}

exim_status() {
  if [ -f /var/run/exim.pid ]; then
    echo "exim is running...";
  else 
    echo "exim is not running...";
  fi
}

# See how we were called.
case "$1" in
  start)
    exim_start
    ;;
  stop)
    exim_stop
    ;;
  restart)
    exim_stop
    sleep 2
    exim_start
    ;;
  reload)
    exim_reload
    ;;
  status)
    exim_status 
    ;;
  *)
    echo $"Usage: $0 {start|stop|restart|reload|status}"
    ;;
esac