Last active
July 16, 2018 17:18
-
-
Save mindfullsilence/9d169f7cf9a3eb8b800eb251a0ee8771 to your computer and use it in GitHub Desktop.
Bash scripts to start and stop maintainance mode for wordpress.
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
#!/usr/bin/env bash | |
WP_WEB_ROOT=/var/www/html; | |
cd $WP_WEB_ROOT; | |
# Disable maintainance mode by removing the .maintainance file | |
rm -f $WP_WEB_ROOT/.maintainance; | |
# Flush caches | |
wp cache flush; | |
wp transient delete --all; | |
wp rewrite flush; |
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
#!/usr/bin/env bash | |
WP_WEB_ROOT=/var/www/html; | |
# Maintenance mode file | |
MAINTENANCE=' | |
<?php | |
$upgrade=time(); | |
'; | |
cd $WP_WEB_ROOT; | |
# creates a .maintainance file. | |
# Wordpress sees this and sets the site to maintainance mode. | |
echo $MAINTENANCE | tee $WP_WEB_ROOT/.maintainance; | |
# do maintainance stuff here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment