{"id":399,"date":"2018-12-23T14:16:13","date_gmt":"2018-12-23T11:16:13","guid":{"rendered":"https:\/\/artem.services\/?p=399"},"modified":"2019-01-15T13:58:51","modified_gmt":"2019-01-15T10:58:51","slug":"rclone","status":"publish","type":"post","link":"https:\/\/artem.services\/?p=399","title":{"rendered":"Rclone Google Drive + Backup WordPress"},"content":{"rendered":"<p><img loading=\"lazy\" class=\"size-full wp-image-219 aligncenter\" src=\"https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/Config-Examples-Logo.png\" alt=\"\" width=\"937\" height=\"145\" srcset=\"https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/Config-Examples-Logo.png 937w, https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/Config-Examples-Logo-300x46.png 300w, https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/Config-Examples-Logo-768x119.png 768w\" sizes=\"(max-width: 937px) 100vw, 937px\" \/><\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c <strong>Rclone<\/strong>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncurl https:\/\/rclone.org\/install.sh | sudo bash\r\n<\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u043d\u0444\u0438\u0433 \u0438 \u0437\u0430\u0434\u0430\u0435\u043c \u0435\u043c\u0443 \u0438\u043c\u044f:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nrclone config\r\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nNo remotes found - make a new one\r\nn) New remote\r\ns) Set configuration password\r\nq) Quit config\r\nn\/s\/q&gt; n\r\nname&gt; GoogleDrive\r\n<\/pre>\n<p><!--more--><\/p>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c &quot;<strong>Google Drive<\/strong>&quot;:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nType of storage to configure.\r\nEnter a string value. Press Enter for the default (&quot;&quot;).\r\nChoose a number from below, or type in your own value\r\n 1 \/ A stackable unification remote, which can appear to merge the contents of several remotes\r\n   \\ &quot;union&quot;\r\n 2 \/ Alias for a existing remote\r\n   \\ &quot;alias&quot;\r\n 3 \/ Amazon Drive\r\n   \\ &quot;amazon cloud drive&quot;\r\n 4 \/ Amazon S3 Compliant Storage Providers (AWS, Ceph, Dreamhost, IBM COS, Minio)\r\n   \\ &quot;s3&quot;\r\n 5 \/ Backblaze B2\r\n   \\ &quot;b2&quot;\r\n 6 \/ Box\r\n   \\ &quot;box&quot;\r\n 7 \/ Cache a remote\r\n   \\ &quot;cache&quot;\r\n 8 \/ Dropbox\r\n   \\ &quot;dropbox&quot;\r\n 9 \/ Encrypt\/Decrypt a remote\r\n   \\ &quot;crypt&quot;\r\n10 \/ FTP Connection\r\n   \\ &quot;ftp&quot;\r\n11 \/ Google Cloud Storage (this is not Google Drive)\r\n   \\ &quot;google cloud storage&quot;\r\n12 \/ Google Drive\r\n   \\ &quot;drive&quot;\r\n13 \/ Hubic\r\n   \\ &quot;hubic&quot;\r\n14 \/ JottaCloud\r\n   \\ &quot;jottacloud&quot;\r\n15 \/ Local Disk\r\n   \\ &quot;local&quot;\r\n16 \/ Mega\r\n   \\ &quot;mega&quot;\r\n17 \/ Microsoft Azure Blob Storage\r\n   \\ &quot;azureblob&quot;\r\n18 \/ Microsoft OneDrive\r\n   \\ &quot;onedrive&quot;\r\n19 \/ OpenDrive\r\n   \\ &quot;opendrive&quot;\r\n20 \/ Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)\r\n   \\ &quot;swift&quot;\r\n21 \/ Pcloud\r\n   \\ &quot;pcloud&quot;\r\n22 \/ QingCloud Object Storage\r\n   \\ &quot;qingstor&quot;\r\n23 \/ SSH\/SFTP Connection\r\n   \\ &quot;sftp&quot;\r\n24 \/ Webdav\r\n   \\ &quot;webdav&quot;\r\n25 \/ Yandex Disk\r\n   \\ &quot;yandex&quot;\r\n26 \/ http Connection\r\n   \\ &quot;http&quot;\r\nStorage&gt; drive\r\n<\/pre>\n<p>&quot;<strong>Client Id<\/strong>&quot; \u0438 &quot;<strong>Client Secret<\/strong>&quot; \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nGoogle Application Client Id\r\nLeave blank normally.\r\nEnter a string value. Press Enter for the default (&quot;&quot;).\r\nclient_id&gt; \r\nGoogle Application Client Secret\r\n<\/pre>\n<p>\u0414\u0430\u0435\u043c \u043f\u043e\u043b\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0430:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nScope that rclone should use when requesting access from drive.\r\nEnter a string value. Press Enter for the default (&quot;&quot;).\r\nChoose a number from below, or type in your own value\r\n 1 \/ Full access all files, excluding Application Data Folder.\r\n   \\ &quot;drive&quot;\r\n 2 \/ Read-only access to file metadata and file contents.\r\n   \\ &quot;drive.readonly&quot;\r\n   \/ Access to files created by rclone only.\r\n 3 | These are visible in the drive website.\r\n   | File authorization is revoked when the user deauthorizes the app.\r\n   \\ &quot;drive.file&quot;\r\n   \/ Allows read and write access to the Application Data folder.\r\n 4 | This is not visible in the drive website.\r\n   \\ &quot;drive.appfolder&quot;\r\n   \/ Allows read-only access to file metadata but\r\n 5 | does not allow any access to read or download file content.\r\n   \\ &quot;drive.metadata.readonly&quot;\r\nscope&gt; 1\r\n<\/pre>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0443\u0441\u0442\u044b\u043c\u0438:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nService Account Credentials JSON file path \r\nLeave blank normally.\r\nNeeded only if you want use SA instead of interactive login.\r\nEnter a string value. Press Enter for the default (&quot;&quot;).\r\nservice_account_file&gt;\r\n<\/pre>\n<p>\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043d\u0435 \u0437\u0430\u0434\u0430\u0435\u043c:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nEdit advanced config? (y\/n)\r\ny) Yes\r\nn) No\r\ny\/n&gt; n\r\n<\/pre>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c &quot;<strong>No<\/strong>&quot;, \u0442\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 \u043d\u0435\u0442 \u0433\u0440\u0430\u0444\u0438\u043a\u0438:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nRemote config\r\nUse auto config?\r\n * Say Y if not sure\r\n * Say N if you are working on a remote or headless machine or Y didn't work\r\ny) Yes\r\nn) No\r\ny\/n&gt; n\r\n<\/pre>\n<p>\u041f\u0443\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432\u0438\u0434\u0430:<\/p>\n<pre>If your browser doesn't open automatically go to the following link: https:\/\/accounts.google.com\/o\/oauth2\/auth?access_type=offline&amp;client_id=202264815644.apps.googleusercontent.com&amp;redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&amp;response_type=code&amp;scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&amp;state=c376b0f0f28b32b98f50e5dde0d5c7c8\r\nLog in and authorize rclone for access<\/pre>\n<p>\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u0438 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u0432\u0445\u043e\u0434\u0438\u043c \u0432 Google \u0430\u043a\u043a\u0430\u0443\u043d\u0442, \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f <strong>Rclone<\/strong> \u0438 \u043e\u0442\u0432\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u043e\u043a\u0435\u043d. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c, \u0438 \u0432\u0432\u043e\u0434\u0438\u043c \u0442\u043e\u043a\u0435\u043d:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nEnter verification code&gt; 4\/twCL5mas7QIln8g89uF2jztXKjrey0RnWrlzJ8hv0lcjE8Pc3KKLIoc\r\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nConfigure this as a team drive?\r\ny) Yes\r\nn) No\r\ny\/n&gt; n\r\n--------------------\r\n[GoogleDrive]\r\ntype = drive\r\nscope = drive\r\ntoken = {&quot;access_token&quot;:&quot;ya29.Glt2BjmIYXAcb0i-HRNeR5f9mPsEe3YqKgHZGsEZCYIRGKgcfbyyqoHttC31h9eFAXMyBJNKHuSlaVefOEyngJzAdYijDx5G5TIK3rWVkg3577rrY4kWm_BuL6aU&quot;,&quot;token_type&quot;:&quot;Bearer&quot;,&quot;refresh_token&quot;:&quot;1\/OwOeusXLWk7V2nIsF9T9e83bsTY8qmzbkS4MKJJSQln8R8q0B2_NvBfu-hN3YFmf&quot;,&quot;expiry&quot;:&quot;2018-12-18T12:56:27.537430889+02:00&quot;}\r\n--------------------\r\ny) Yes this is OK\r\ne) Edit this remote\r\nd) Delete this remote\r\ny\/e\/d&gt; y\r\nCurrent remotes:\r\n\r\nName                 Type\r\n====                 ====\r\nGoogleDrive          drive\r\n\r\ne) Edit existing remote\r\nn) New remote\r\nd) Delete remote\r\nr) Rename remote\r\nc) Copy remote\r\ns) Set configuration password\r\nq) Quit config\r\ne\/n\/d\/r\/c\/s\/q&gt; q\r\n<\/pre>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u043d\u0430 &quot;<strong>Google Drive<\/strong>&quot;:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nrclone ls GoogleDrive:\r\n<\/pre>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 &quot;<strong>Google Drive<\/strong>&quot;:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nrclone lsd GoogleDrive:\r\n<\/pre>\n<blockquote><p><strong>GoogleDrive<\/strong> &#8212; \u0438\u043c\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0445\u043e\u0441\u0442\u0430 <strong>rclone<\/strong> \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438.<\/p><\/blockquote>\n<h2>WordPress Backup<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0434\u043b\u044f \u0431\u0435\u043a\u0430\u043f\u043e\u0432:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nrclone mkdir GoogleDrive:BACKUP\/artem.services\r\n<\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0434\u043b\u044f \u0431\u0435\u043a\u0430\u043f\u043e\u0432, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u043c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u043d\u0430 &quot;<strong>Google Drive<\/strong>&quot;:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nmkdir -p \/BACKUP\/artem.services\r\n<\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0438\u0440\u0438\u043a\u0442\u043e\u0440\u0438\u044f \u0434\u043b\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u0430:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nmkdir \/scripts\r\n<\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0431\u0435\u043a\u0430\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0430\u0437\u044b &quot;<strong>WordPress<\/strong>&quot; \u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0441\u0430\u0439\u0442\u0430:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nvim \/scripts\/backup_artem.services.sh\r\n<\/pre>\n<p>\u0421\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n#!\/bin\/bash\r\n\r\nDATE=$(date +%d-%m-%Y)\r\nBACKUP_PATH=&quot;\/BACKUP\/artem.services&quot;\r\nSITE_PATH=&quot;\/var\/www\/html\/artem_services&quot;\r\nDATABASE=&quot;artem_services&quot;\r\n\r\nmkdir $BACKUP_PATH\/$DATE\r\n\r\ntar -zcvf $BACKUP_PATH\/$DATE\/site.tar.gz --directory=&quot;$SITE_PATH\/&quot; .\/\r\nmysqldump -u root $DATABASE | gzip -c &gt; \/$BACKUP_PATH\/$DATE\/database.gz\r\n\r\nfind $BACKUP_PATH -type d -mtime +5 -exec rm -rv {} \\;\r\n\r\n\/usr\/bin\/rclone sync $BACKUP_PATH\/ GoogleDrive:\/BACKUP\/artem.services\r\n<\/pre>\n<p>\u0414\u0435\u043b\u0430\u0435\u043c \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u043c:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nchmod +x \/scripts\/backup_artem.services.sh\r\n<\/pre>\n<p>\u0418 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0433\u043e \u0432 \u043a\u0440\u043e\u043d \u0440\u0430\u0437 \u0432 \u0434\u0435\u043d\u044c \u0432 \u043f\u043e\u043b\u043d\u043e\u0447\u044c:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncrontab -e\r\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n0 0 * * * \/scripts\/backup_artem.services.sh\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Rclone: \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u043d\u0444\u0438\u0433 \u0438 \u0437\u0430\u0434\u0430\u0435\u043c \u0435\u043c\u0443 \u0438\u043c\u044f:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[101,100,99,102,11],"_links":{"self":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/399"}],"collection":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=399"}],"version-history":[{"count":12,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/399\/revisions"}],"predecessor-version":[{"id":500,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/399\/revisions\/500"}],"wp:attachment":[{"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=399"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=399"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=399"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}