Skip to content

Instantly share code, notes, and snippets.

@josh-h
Created July 28, 2014 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josh-h/e869c0957b2f44367cac to your computer and use it in GitHub Desktop.
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
#!/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