Change status of Maintenance mode from console
-
Thank you for the cool plugin. I would like to share a little command that allows you to change the maintenance status of your WordPress blog right from the console.
Go to maintenance mode:
echo "SELECT option_value from wp_options WHERE option_name LIKE \"wpmm_settings\";" | mysql --host YOUR_HOST -u YOUR_USER -pYOUR_PASS YOUR_DB | sed -n 2p | sed 's|"status";i:0;|"status";i:1;|' | sed "s|'|\\\'|g" | sed "s/^/UPDATE wp_options SET option_value='/" | sed "s/$/' WHERE option_name LIKE \"wpmm_settings\";/" | mysql --host YOUR_HOST -u YOUR_USER -pYOUR_PASS YOUR_DB
Go out of maintenance mode:
echo "SELECT option_value from wp_options WHERE option_name LIKE \"wpmm_settings\";" | mysql --host YOUR_HOST -u YOUR_USER -pYOUR_PASS YOUR_DB | sed -n 2p | sed 's|"status";i:1;|"status";i:0;|' | sed "s|'|\\\'|g" | sed "s/^/UPDATE wp_options SET option_value='/" | sed "s/$/' WHERE option_name LIKE \"wpmm_settings\";/" | mysql --host YOUR_HOST -u YOUR_USER -pYOUR_PASS YOUR_DB
Note: You need to replace YOUR_HOST, YOUR_USER, YOUR_PASS and YOUR_DB strings with the actual credentials.
Might be useful in automated deployment script. I hope it help to someone. ^__^
- The topic ‘Change status of Maintenance mode from console’ is closed to new replies.