summaryrefslogtreecommitdiffstats
path: root/network/opensmtpd/rc.opensmtpd
blob: f3154061c58dffa5e783dcaf487e50ed802bf6ae (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/sh
# Start/stop/restart opensmtpd

smtpd_start() {
  if [ -x /usr/sbin/smtpd ]; then
    echo "Starting OpenSMTPD:  /usr/sbin/smtpd"
    /usr/sbin/smtpd
  fi
}

smtpd_stop() {
  echo "Stopping OpenSMTPD"
  /usr/bin/pkill -f /usr/sbin/smtpd
}

# Restart smtpd:
smtpd_restart() {
  smtpd_stop
  sleep 1
  smtpd_start
}

# Test the smtpd configuration:
smtpd_testconf() {
    echo "testing OpenSMTPD configuration:  /usr/sbin/smtpd -n"
    /usr/sbin/smtpd -n
}

case "$1" in
'start')
  smtpd_start
  ;;
'stop')
  smtpd_stop
  ;;
'restart')
  smtpd_restart
  ;;
'testconf')
  smtpd_testconf
  ;;
*)
  echo "usage $0 start|stop|restart|testconf"
esac