blob: f3c012bbd287aeee20c1bf7ae13fa0f511affd2d (
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
63
64
65
66
67
68
69
70
|
#! /bin/sh
set -e
### BEGIN INIT INFO
# Provides: postfix mail-transport-agent
# Required-Start: $local_fs $remote_fs $syslog $named $network $time
# Required-Stop: $local_fs $remote_fs $syslog $named $network
# Should-Start: postgresql mysql clamav-daemon postgrey spamassassin saslauthd dovecot
# Should-Stop: postgresql mysql clamav-daemon postgrey spamassassin saslauthd dovecot
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Postfix Mail Transport Agent
# Description: postfix is a Mail Transport agent
### END INIT INFO
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/sbin/postfix
unset TZ
[ -x $DAEMON ] && [ -f /etc/postfix/main.cf ] || exit 0
. /lib/lsb/init-functions
case "$1" in
(start) # iterate: quiet-if-already-running, skip disabled instances
log_daemon_msg "Starting the Postfix mail system"
rc=0 && postmulti -x "$0" internal-instance-$1 || rc=$?
log_end_msg $rc
;;
(internal-instance-start)
[ yes = $multi_instance_enable ] || exit 0
$daemon_directory/master -t 2>/dev/null || exit 0 # already running
log_progress_msg ${multi_instance_name:-$config_directory}
err=$($DAEMON start 2>&1) || { echo "$err" >&2; exit 1; }
;;
(stop) # iterate: quiet-if-not-running
log_daemon_msg "Stopping the Postfix mail system"
rc=0 && postmulti -x "$0" internal-instance-$1 || rc=$?
log_end_msg $rc
;;
(internal-instance-stop) # do not fail if already stopped
$daemon_directory/master -t 2>/dev/null && exit 0
log_progress_msg ${multi_instance_name:-$config_directory}
err=$($DAEMON stop 2>&1) || { echo "$err" >&2; exit 1; }
;;
(status)
postmulti -x "$0" internal-instance-status
;;
(internal-instance-status) # no fail if a disabled instance is not running
$DAEMON status || [ yes != $multi_instance_enable ]
;;
(status|reload|force-reload|flush|check|abort)
$DAEMON ${1#force-} || { log_end_msg 1; exit 1; }
;;
restart)
$0 stop || :
$0 start
;;
(*)
log_action_msg "Usage: /etc/init.d/postfix {start|stop|restart|reload|force-reload|flush|check|abort|status}"
exit 1
;;
esac
|