Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
OSX Server v3.1.2 mail restart script /etc/periodic/daily/500.restart-mail
#!/bin/sh
# Restart mail, otherwise our push notifications get hung up.
# If there is a global system configuration file, suck it in.
#
if [ -r /etc/defaults/periodic.conf ]
then
. /etc/defaults/periodic.conf
source_periodic_confs
fi
serveradmin=/Applications/Server.app/Contents/ServerRoot/usr/sbin/serveradmin
echo ""
echo "Restarting mail services."
rc=$($serveradmin stop mail)
if [ $? -eq 0 ]
then
echo Mail successfully stopped
else
echo Failed to stop mail
fi
rc=$($serveradmin start mail)
if [ $? -eq 0 ]
then
echo Mail successfully started
else
echo Failed to start mail
fi
exit $rc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.