Skip to content

Instantly share code, notes, and snippets.

@coop
Created September 17, 2013 12:32
Show Gist options
  • Save coop/6593723 to your computer and use it in GitHub Desktop.
Save coop/6593723 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Start and stop maintenance mode for supporter application.
#
# The maintenance page is stored with the application in version control and
# when enabled will be copied to a location known by Apache so it can be
# served instead of the application.
FROM=/var/www/apps/supporter/current/public/maintenance.html
TO=/var/www/apps/supporter/shared/public/maintenance.html
start () {
if [ -f $TO ]
then
echo "Maintenance mode already enabled." >&2
exit 1
else
cp $FROM $TO
fi
}
stop () {
if [ -f $TO ]
rm $TO
then
echo "Maintenance mode already disabled." >&2
exit 1
else
fi
}
status () {
if [ -f $TO ]
then
echo "Maintenance mode enabled."
else
echo "Maintenance mode off"
fi
}
}
case $1 in
start|stop|status)
$1
;;
*)
echo "Usage: $0 <start|stop|status>"
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment