{"id":17525,"date":"2019-06-06T11:09:18","date_gmt":"2019-06-06T15:09:18","guid":{"rendered":"https:\/\/www.boldgrid.com\/support\/?p=17525"},"modified":"2021-04-27T12:18:18","modified_gmt":"2021-04-27T16:18:18","slug":"backup-command-line-utilities","status":"publish","type":"post","link":"https:\/\/www.boldgrid.com\/support\/total-upkeep\/backup-command-line-utilities\/","title":{"rendered":"Using Total Upkeep Command Line Utilities"},"content":{"rendered":"<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\">\n<?xml encoding=\"utf-8\" ?><html><body><p><img decoding=\"async\" class=\"alignnone size-full\" src=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2019\/11\/total-upkeep-horizontal-image-2.png\" alt=\"Total Upkeep WordPress Backup Plugin\"><\/p>\n<p>The Total Upkeep <a href=\"\/wordpress-backup-plugin\/\">WordPress backup plugin<\/a> (<a href=\"\/support\/total-upkeep\/what-is-total-upkeep\/\">previously known as BoldGrid Backup<\/a>) 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 <a href=\"https:\/\/github.com\/BoldGrid\/total-upkeep\/wiki\/CLI-Commands\">our GitHub Wiki.<\/a><\/p>\n<p>In order to follow the guides on this page, you&rsquo;ll need ssh access to your server. Some <a href=\"\/wordpress-hosting\/\">WordPress hosts<\/a> do not offer ssh access &ndash; you&rsquo;ll need to follow up with your host if you&rsquo;re not sure they do.<\/p>\n<h2 id=\"using-site-check-from-the-command-line\">Using Site Check from the Command Line<\/h2>\n<p>Total Upkeep&rsquo;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.<\/p>\n<ol>\n<li><strong>SSH into your WordPress<\/strong> hosting environment, using your Web Host&rsquo;s instructions for doing so.<\/li>\n<li><strong>Change directories&nbsp;<\/strong>into the <a href=\"https:\/\/www.boldgrid.com\/support\/total-upkeep\/what-is-total-upkeep\/\">BoldGrid Backup<\/a> directory. In this example, we&rsquo;re using&nbsp;<strong>~\/public_html<\/strong> as the WordPress Root directory.\n<pre>user@wordpress [~]$ cd ~\/public_html\/wp-content\/plugins\/boldgrid-backup<\/pre>\n<\/li>\n<li><strong>Run the check<\/strong> by using the command&nbsp;<strong>php cli\/bgbkup-cli.php<\/strong>\n<pre>user@wordpress [wp-content\/boldgrid-backup]$ php cli\/bgbkup-cli.php\r\nInfo: No action taken.<\/pre>\n<\/li>\n<li><strong>Examine the output<\/strong> from your command. If no action was taken, your Site Check passed.<\/li>\n<li>Optionally, you can configure the error log level with the command&nbsp;<strong>php cli\/bgbkup-cli.php check log<\/strong> which will log any errors with the severity LOG_NOTICE or higher.<\/li>\n<li>Optionally, you can auto-recover from a failure, which will restore the most recent backup, using the command&nbsp;<strong>php cli\/bgbkup-cli.php check auto_recovery=1<\/strong><\/li>\n<\/ol>\n<h2 id=\"restoring-a-backup-from-the-command-line\">Restoring a Backup from the Command Line<\/h2>\n<ol>\n<li><strong>SSH into your WordPress<\/strong> hosting environment, using your Web Host&rsquo;s instructions for doing so.<\/li>\n<li><strong>Change directories&nbsp;<\/strong>into the BoldGrid Backup directory. In this example, we&rsquo;re using&nbsp;<strong>~\/public_html<\/strong> as the WordPress Root directory.\n<pre>user@wordpress [~]$ cd ~\/public_html\/wp-content\/plugins\/boldgrid-backup<\/pre>\n<\/li>\n<li><strong>Restore the most recent backup<\/strong> using the command&nbsp;<strong>php cli\/bgbkup-cli.php restore<\/strong>\n<pre>user@wordpress [wp-content\/boldgrid-backup]$ php cli\/bgbkup-cli.php restore\r\nStarting restoration process...\r\nAttempting to restore \"https:\/\/domain.com\" from backup archive file \"\/home\/user\/boldgrid_backup\/backup.zip\"...\r\nCannot reach the site URL; using standalone restoration process...\r\nAttempting file restoration using PHP ZipArchive...\r\nSuccess.\r\nAttempting to restore database using PHP PDO...\r\nSuccess.<\/pre>\n<\/li>\n<li>Optionally, if you need to restore a different backup from the command line, you can specify the filename:\n<pre>user@wordpress [wp-content\/boldgrid-backup]$ php cli\/bgbkup-cli.php restore zip=\/home\/user\/boldgrid_backup\/backup.zip\r\nStarting restoration process...\r\nAttempting to restore \"https:\/\/domain.com\" from backup archive file \"\/home\/user\/boldgrid_backup\/backup.zip\"...\r\nCannot reach the site URL; using standalone restoration process...\r\nAttempting file restoration using PHP ZipArchive...\r\nSuccess.\r\nAttempting to restore database using PHP PDO...\r\nSuccess.<\/pre>\n<\/li>\n<\/ol>\n<p>Congratulations! You now know how to keep your site safe and restore a backup from the command line in an emergency.<\/p>\n<\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1294,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"bgseo_title":"Restore a Backup from the Command Line | Total Upkeep","bgseo_description":"Total Upkeep keeps your site safe, even if a fatal error is preventing you from accessing your WordPress Dashboard. Use these instructions to restore a backup from the command line in the event of an emergency.","bgseo_robots_index":"index","bgseo_robots_follow":"follow","footnotes":""},"categories":[762,453],"tags":[668,54],"class_list":["post-17525","post","type-post","status-publish","format-standard","hentry","category-settings","category-total-upkeep","tag-command-line","tag-restore","feature-type-free","experience-level-advanced"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/posts\/17525","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/users\/1294"}],"replies":[{"embeddable":true,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/comments?post=17525"}],"version-history":[{"count":15,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/posts\/17525\/revisions"}],"predecessor-version":[{"id":36826,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/posts\/17525\/revisions\/36826"}],"wp:attachment":[{"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/media?parent=17525"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/categories?post=17525"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/tags?post=17525"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}