blob: 198221ae87a0a4dbc6f9e4acde867c23005a6022 (
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
|
#!/bin/bash
LOCKFILE="/var/mail-state/lib-postfix/master.lock"
function log() {
echo "[health] $@"
}
if [ -f "$LOCKFILE" ]; then
PID=$(cat "$LOCKFILE")
log "pid $PID"
if kill -0 "$PID" 2>/dev/null; then
if ss --listening --tcp | grep -P 'LISTEN.+:smtp' > /dev/null; then
log "successfully listening to smtp"
exit 0
fi
else
# Not our postfix lock.
exit 0
fi
fi
log "bad health state"
exit 1
|