The Total Upkeep WordPress backup plugin (previously known as BoldGrid Backup) is here to make sure your site is protected from fatal errors, hacking, and data loss. Sometimes, if your website has been damaged and you cannot access the WordPress Dashboard, you may need to use the command line to get your site back up and running. The command line documentation is officially maintained on our GitHub Wiki.
In order to follow the guides on this page, you’ll need ssh access to your server. Some WordPress hosts do not offer ssh access – you’ll need to follow up with your host if you’re not sure they do.
Using Site Check from the Command Line
Total Upkeep’s Site Check is designed to be configured within the WordPress Dashboard, where it can be enabled and scheduled to run at regular intervals. However, you can run it manually.
- SSH into your WordPress hosting environment, using your Web Host’s instructions for doing so.
- Change directories into the BoldGrid Backup directory. In this example, we’re using ~/public_html as the WordPress Root directory.
user@wordpress [~]$ cd ~/public_html/wp-content/plugins/boldgrid-backup
- Run the check by using the command php cli/bgbkup-cli.php
user@wordpress [wp-content/boldgrid-backup]$ php cli/bgbkup-cli.php Info: No action taken.
- Examine the output from your command. If no action was taken, your Site Check passed.
- Optionally, you can configure the error log level with the command php cli/bgbkup-cli.php check log which will log any errors with the severity LOG_NOTICE or higher.
- Optionally, you can auto-recover from a failure, which will restore the most recent backup, using the command php cli/bgbkup-cli.php check auto_recovery=1
Restoring a Backup from the Command Line
- SSH into your WordPress hosting environment, using your Web Host’s instructions for doing so.
- Change directories into the BoldGrid Backup directory. In this example, we’re using ~/public_html as the WordPress Root directory.
user@wordpress [~]$ cd ~/public_html/wp-content/plugins/boldgrid-backup
- Restore the most recent backup using the command php cli/bgbkup-cli.php restore
user@wordpress [wp-content/boldgrid-backup]$ php cli/bgbkup-cli.php restore Starting restoration process... Attempting to restore "https://domain.com" from backup archive file "/home/user/boldgrid_backup/backup.zip"... Cannot reach the site URL; using standalone restoration process... Attempting file restoration using PHP ZipArchive... Success. Attempting to restore database using PHP PDO... Success.
- Optionally, if you need to restore a different backup from the command line, you can specify the filename:
user@wordpress [wp-content/boldgrid-backup]$ php cli/bgbkup-cli.php restore zip=/home/user/boldgrid_backup/backup.zip Starting restoration process... Attempting to restore "https://domain.com" from backup archive file "/home/user/boldgrid_backup/backup.zip"... Cannot reach the site URL; using standalone restoration process... Attempting file restoration using PHP ZipArchive... Success. Attempting to restore database using PHP PDO... Success.
Congratulations! You now know how to keep your site safe and restore a backup from the command line in an emergency.
SIGNUP FOR
BOLDGRID CENTRAL
200+ Design Templates + 1 Kick-ass SuperTheme
6 WordPress Plugins + 2 Essential Services
Everything you need to build and manage WordPress websites in one Central place.