25 lines
519 B
Bash
Executable File
25 lines
519 B
Bash
Executable File
#!/bin/sh
|
|
# Program:
|
|
# * restart mail server related daemons
|
|
# Dependency:
|
|
# * nil
|
|
# History:
|
|
# * Chang, Chu-Kuan <cckuan@changchukuan.name>
|
|
|
|
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
|
|
|
|
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
|
|
done
|