In the previous post I wrote about how to transfer my own WordPress blog, to a static generated site using Wintersmith, but now, I need to take down the blog, so first thing, first, we need to create backup of the database and content I have uploaded on the system. So lets see how we can do it.
I needed to put my WordPress into maintenance mode, so I can create a backup of my database, as I don’t want to lose all the information it has, like users, posts, comments, content, and so on.
The first step was to put the blog into maintenance mode, to do so, we can do fairly easily, the only thing we need to do is create a file called .maintenance in the root of the blog folder.
To do so we can execute the following command:
echo "<?php \$upgrading = time(); ?>" > .maintenance
This will create the file with the necesseary contents for the blog to be in maintenance mode. So now your site should be in maintenance mode for a while or until you remove the file.
The function uses the following sum to work out how long to stay in maintenance mode for
The time now = The time specified – 10 minutes
So in the above example when we are using the time() function the sum will always be within 10 minutes.
If you want you can also just supply the time in unix timestamp for when you want the in the future, let’s say in Sun, 20 Oct 2030 10:30:00 GMT so in that case you can create the file like:
echo "<?php \$upgrading = 1918723200; ?>" > .maintenance
If you want to stop maintenance mode, it’s really simple, just delete the file and the maintenance mode is over, and the blog will continue functioning as normal