2020-09-12 14:54:16 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# Program:
|
|
|
|
# * restart mail server related daemons
|
|
|
|
# Dependency:
|
|
|
|
# * nil
|
|
|
|
# History:
|
2021-01-17 19:38:48 +00:00
|
|
|
# * Chang, Chu-Kuan <cckuan@changchukuan.name>
|
2020-09-12 14:54:16 +00:00
|
|
|
|
|
|
|
readonly progname="$(basename "$0")"
|
|
|
|
|
|
|
|
if test "$(id -u)" != '0'; then
|
|
|
|
printf '%s: Root access required.\n' "${progname}"
|
|
|
|
printf '%s: Exiting...\n' "${progname}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-02-12 03:38:24 +00:00
|
|
|
for x in 'smtpd' 'dovecot' 'rspamd' 'redis'; do
|
|
|
|
printf '%s: Restarting %s...' "${progname}" "$x"
|
|
|
|
if rcctl restart "$x" 2>&1 > /dev/null; then
|
|
|
|
printf ' Done\n'
|
|
|
|
else
|
|
|
|
printf ' Failed\n'
|
|
|
|
fi
|
2020-09-12 14:54:16 +00:00
|
|
|
done
|