File: perdition.suse

package info (click to toggle)
perdition 2.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,676 kB
  • sloc: ansic: 14,560; sh: 5,274; makefile: 391
file content (193 lines) | stat: -rw-r--r-- 5,202 bytes parent folder | download | duplicates (8)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
#!/bin/sh
#
# Author: Simon Horman <horms@verge.net.au>
#
### BEGIN INIT INFO
# Provides:          perdition
# Required-Start:    $remote_fs
# Should-Start:      $syslog $named
# Required-Stop:     $remote_fs
# Should-Stop:       $syslog $named
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: POP, IMAP and managesieve proxy
# Description:       Starts perdition to allow proxied POP, IMAP and managesieve access
### END INIT INFO

# Source function library.
. /etc/rc.status

if [ -f /etc/sysconfig/perdition ]; then
  . /etc/sysconfig/perdition
fi

# Please do not edit the values below.
# Rather, please edit /etc/sysconfig/perdition
RUN_PERDITION="${RUN_PERDITION:=yes}"
FLAGS="${FLAGS:=}"
POP3="${POP3:=yes}"
POP3_FLAGS="${POP3_FLAGS:=}"
POP3S="${POP3S:=yes}"
POP3S_FLAGS="${POP3S_FLAGS:=}"
IMAP4="${IMAP4:=yes}"
IMAP4_FLAGS="${IMAP4_FLAGS:=}"
IMAP4S="${IMAP4S:=yes}"
IMAP4S_FLAGS="${IMAP4S_FLAGS:=}"
MANAGESIEVE="${MANAGESIEVE:=yes}"
MANAGESIEVE_FLAGS="${MANAGESIEVE_FLAGS:=}"

POP3_BIN="/usr/sbin/perdition.pop3"
POP3_PID="/var/run/perdition.pop3/perdition.pop3.pid"
POP3S_BIN="/usr/sbin/perdition.pop3s"
POP3S_PID="/var/run/perdition.pop3s/perdition.pop3s.pid"
IMAP4_BIN="/usr/sbin/perdition.imap4"
IMAP4_PID="/var/run/perdition.imap4/perdition.imap4.pid"
IMAP4S_BIN="/usr/sbin/perdition.imaps"
IMAP4S_PID="/var/run/perdition.imaps/perdition.imaps.pid"
MANAGESIEVE_BIN="/usr/sbin/perdition.managesieve"
MANAGESIEVE_PID="/var/run/perdition.managesieve/perdition.managesieve.pid"

if [ "$RUN_PERDITION" != "yes" ]; then
	exit 0
fi

# See how we were called.
case "$1" in
  start)
	if [ "$POP3" = "yes" ]; then
		echo -n "Starting perdition daemon (POP3): "
		$POP3_BIN $FLAGS $POP3_FLAGS --pid_file $POP3_PID && \
		[ -e $POP3_PID ] && \
		checkproc -p $POP3_PID $POP3_BIN
		rc_status -v
	fi

	if [ "$POP3S" = "yes" ]; then
		echo -n "Starting perdition daemon (POP3S): "
		$POP3S_BIN $FLAGS $POP3S_FLAGS --pid_file $POP3S_PID && \
		[ -e $POP3S_PID ] && \
		checkproc -p $POP3S_PID $POP3S_BIN
		rc_status -v
	fi

	if [ "$IMAP4" = "yes" ]; then
		echo -n "Starting perdition daemon (IMAP4): "
		$IMAP4_BIN $FLAGS $IMAP4_FLAGS --pid_file $IMAP4_PID && \
		[ -e $IMAP4_PID ] && \
		checkproc -p $IMAP4_PID $IMAP4_BIN
		rc_status -v
	fi

	if [ "$IMAP4S" = "yes" ]; then
		echo -n "Starting perdition daemon (IMAP4S): "
		$IMAP4S_BIN $FLAGS $IMAP4S_FLAGS --pid_file $IMAP4S_PID && \
		[ -e $IMAP4S_PID ] && \
		checkproc -p $IMAP4S_PID $IMAP4S_BIN
		rc_status -v
	fi
	if [ "$MANAGESIEVE" = "yes" ]; then
		echo -n "Starting perdition daemon (MANAGESIEVE): "
		$MANAGESIEVE_BIN $FLAGS $MANAGESIEVE_FLAGS --pid_file $MANAGESIEVE_PID && \
		[ -e $MANAGESIEVE_PID ] && \
		checkproc -p $MANAGESIEVE_PID $MANAGESIEVE_BIN
		rc_status -v
	fi
	;;
  status)
        if [ "$POP3" = "yes" ]; then
		echo -n "Checking for perdition (POP3): "
		checkproc -p $POP3_PID $POP3_BIN
		rc_status -v
	fi
        if [ "$POP3S" = "yes" ]; then
		echo -n "Checking for perdition (POP3S): "
		checkproc -p $POP3S_PID $POP3S_BIN
		rc_status -v
	fi
	if [ "$IMAP4" = "yes" ]; then
		echo -n "Checking for perdition (IMAP4): "
		checkproc -p $IMAP4_PID $IMAP4_BIN
		rc_status -v
	fi
	if [ "$IMAP4S" = "yes" ]; then
		echo -n "Checking for perdition (IMAP4S): "
		checkproc -p $IMAP4S_PID $IMAP4S_BIN
		rc_status -v
	fi
	if [ "$MANAGESIEVE" = "yes" ]; then
		echo -n "Checking for perdition (MANAGESIEVE): "
		checkproc -p $MANAGESIEVE_PID $MANAGESIEVE_BIN
		rc_status -v
	fi
	;;
  try-restart)
	$0 status >/dev/null &&  $0 restart
	rc_status
	;;
  restart)
        $0 stop
	$0 start
        ;;
  reload|force-reload)
        if [ "$POP3" = "yes" ]; then
		echo -n "Checking for perdition (POP3): "
		killproc -HUP -p $POP3_PID $POP3_BIN
		rc_status -v
	fi
        if [ "$POP3S" = "yes" ]; then
		echo -n "Checking for perdition (POP3S): "
		killproc -HUP -p $POP3S_PID $POP3S_BIN
		rc_status -v
	fi
	if [ "$IMAP4" = "yes" ]; then
		echo -n "Checking for perdition (IMAP4): "
		killproc -HUP -p $IMAP4_PID $IMAP4_BIN
		rc_status -v
	fi
	if [ "$IMAP4S" = "yes" ]; then
		echo -n "Checking for perdition (IMAP4S): "
		killproc -HUP -p $IMAP4S_PID $IMAP4S_BIN
		rc_status -v
	fi
	if [ "$MANAGESIEVE" = "yes" ]; then
		echo -n "Checking for perdition (MANAGESIEVE): "
		killproc -HUP -p $MANAGESIEVE_PID $MANAGESIEVE_BIN
		rc_status -v
	fi
	;;
  stop)
	if [ "$POP3" = "yes" ]; then
		echo -n "Shutting down perdition services (POP3): "
		killproc -TERM -p $POP3_PID $POP3_BIN
		rc_status -v
	fi

	if [ "$POP3S" = "yes" ]; then
		echo -n "Shutting down perdition services (POP3S): "
		killproc -TERM -p $POP3S_PID $POP3S_BIN
		rc_status -v
	fi

	if [ "$IMAP4" = "yes" ]; then
		echo -n "Shutting down perdition services (IMAP4): "
		killproc -TERM -p $IMAP4_PID $IMAP4_BIN
		rc_status -v
	fi

	if [ "$IMAP4S" = "yes" ]; then
		echo -n "Shutting down perdition services (IMAP4S): "
		killproc -TERM -p $IMAP4S_PID $IMAP4S_BIN
		rc_status -v
	fi
	if [ "$MANAGESIEVE" = "yes" ]; then
		echo -n "Shutting down perdition services (MANAGESIEVE): "
		killproc -TERM -p $MANAGESIEVE_PID $MANAGESIEVE_BIN
		rc_status -v
	fi
	;;
  *)
	echo "Usage: perdition {start|stop|status|restart|reload}"
	exit 1
esac

exit 0