Created
July 28, 2014 14:49
-
-
Save josh-h/e869c0957b2f44367cac to your computer and use it in GitHub Desktop.
OSX Server v3.1.2 mail restart script /etc/periodic/daily/500.restart-mail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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