maintenance.sh lets Waddle open and close a site’s frontend on a remote environment, for
example while a database sync or a deploy is in progress. It is exposed in the UI under a
project’s remote actions → toggle maintenance mode, and the label reflects the current state
(on/off).
Where it lives
website/script/unix/<platform>/maintenance.sh
A platform only gets the maintenance toggle when this file exists. Waddle checks for it and hides the action otherwise. Any platform, including a custom blueprint, can add the toggle simply by providing the file.
Contract
Every implementation of this hook must follow the same contract, since Waddle invokes it identically regardless of platform. It is called with one argument and must handle three actions:
| Argument | Required behaviour |
|---|---|
is-active |
Print active or inactive (nothing else) so the UI can show the current state. |
enable |
Turn maintenance mode on (close the frontend). |
disable |
Turn maintenance mode off (re-open the frontend). |
Rules:
#!/bin/sh -eu, POSIX-compliant, run from the project root.- Exit non-zero (with a usage message) on an unknown argument, so a bad call fails loudly instead of silently leaving the UI’s toggle showing the wrong state.
is-activemust be derived from a reliable source, like a flag in the db / a file.
How each shipped platform implements it
| Platform | enable / disable | is-active source |
|---|---|---|
| WordPress | wp maintenance-mode activate/deactivate |
website/src/.maintenance file |
| Magento | bin/magento maintenance:enable/disable |
website/src/var/.maintenance.flag file |
| Laravel (Bagisto, Krayin, FreeScout, WinterCMS) | php artisan down / php artisan up |
storage/framework/down (or maintenance.php) file |
| Flarum | php flarum down / php flarum up |
'offline' => true in website/src/config.php |
| phpBB | phpbbcli.php config:set board_disable 1/0 |
phpbbcli.php config:get board_disable |
| PrestaShop | SQL PS_SHOP_ENABLE = 0/1 in ps_configuration |
SQL read of PS_SHOP_ENABLE |
Adding it to a custom project
Create website/script/unix/blank/maintenance.sh or website/script/unix/webstack/maintenance.sh,
matching whichever blueprint your project was created with. For example, say your app has no
built-in maintenance mode, so you toggle it with a flag file your own front controller checks. The
script could look like this:
#!/bin/sh -eu
FLAG_FILE="website/src/.maintenance"
ACTION="${1:-}"
case "$ACTION" in
is-active)
if [ -f "$FLAG_FILE" ]; then
echo "active"
else
echo "inactive"
fi
;;
enable)
touch "$FLAG_FILE"
echo "enabled"
;;
disable)
rm -f "$FLAG_FILE"
echo "disabled"
;;
*)
echo "Usage: $0 <is-active|enable|disable>" >&2
exit 1
;;
esac