{"id":57335,"date":"2020-04-09T07:53:54","date_gmt":"2020-04-08T23:53:54","guid":{"rendered":"http:\/\/4563.org\/?p=57335"},"modified":"2020-04-09T07:53:54","modified_gmt":"2020-04-08T23:53:54","slug":"%e6%b1%82rclone-%e5%ae%9a%e6%97%b6%e5%a4%87%e4%bb%bd%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=57335","title":{"rendered":"\u6c42rclone \u5b9a\u65f6\u5907\u4efd\u65b9\u6cd5"},"content":{"rendered":"\n<p>  \t\t\t\t\t<strong>angus1220<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3>\u6c42rclone \u5b9a\u65f6\u5907\u4efd\u65b9\u6cd5<\/h3>\n<p>  \t\t\u6c42rclone \u5b9a\u65f6\u5907\u4efd\u65b9\u6cd5<\/p>\n<p>  rclone copy xxx: gdrive: <\/p>\n<p>  \u8981\u5982\u4f55\u5907\u4efd\u81f3GD\u6bcf\u65e5\u90fd\u5404\u4e00\u4e2a\u8d44\u6599\u5939 \u4e0d\u540c\u65e5\u671f  \t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u7f8a\u6bdb\u515a<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tangus1220 \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2020-4-4 21:25<br \/>  \u60f3\u8981gd<br \/>  \u5206\u6bcf\u65e5\u4e00\u4e2a\u8d44\u6599\u5939\u540c\u65e5\u671f\u8fd9\u6837 \u4e0d\u592a\u4f1a\u8868\u8fbe<\/p>\n<p>  \u4f60\u8981\u7684\u7528\u65e5\u671f\u6807\u9898\u6587\u4ef6\u5939\u2026\u2026\u5c31\u662f\u7528\u65e5\u671f\u53c2\u6570\u521b\u5efa\u6587\u4ef6\u5939\uff0c\u770b\u4e86\u4e0b\u9762\u7684\u811a\u672c\u5185\u5bb9\uff0c\u4f60\u5e94\u8be5\u4f1a\u7684 \u3002<\/p>\n<p>  #!\/bin\/bash<\/p>\n<p>  # \u5b9a\u4e49GOOGLE DRIVE\u7684\u5907\u4efd\u76ee\u5f55<br \/>  GD_PATH=&quot;google-drive:Sync\/www&quot;<\/p>\n<p>  # \u5b9a\u4e49\u5907\u4efd\u7684\u76ee\u5f55\u53ca\u6587\u4ef6\uff0c\u4e0d\u540c\u7684\u76ee\u5f55\u7528\u7a7a\u683c\u5206\u5f00<br \/>  BACKUP_SRC=&quot;\/var\/www\/typecho \/var\/www\/chevereto&quot;<\/p>\n<p>  # \u5b9a\u4e49\u4e34\u65f6\u6587\u4ef6\u5b58\u653e\u76ee\u5f55<br \/>  BACKUP_DST=&quot;\/tmp&quot;<\/p>\n<p>  # \u8bbe\u7f6eMYSQL\u57fa\u672c\u4fe1\u606f <br \/>  MYSQL_SERVER=&quot;localhost&quot;<br \/>  MYSQL_USER=&quot;root&quot;<br \/>  MYSQL_PASS=&quot;password&quot;<\/p>\n<p>  # \u5b9a\u4e49\u60f3\u8981\u5907\u4efd\u7684\u6570\u636e\u5e93\uff0c\u591a\u4e2a\u6570\u636e\u5e93\u7528\u7a7a\u683c\u5206\u5f00<br \/>  BACKUP_DATABASE=&quot;typecho chevereto&quot;<\/p>\n<p>  # \u5b9a\u4e49\u6587\u4ef6\u524d\u7f00\u540d<br \/>  NOW=$(date +&quot;%Y.%m.%d&quot;)<br \/>  OLD=$(date -d -10day +&quot;%Y.%m.%d&quot;)<\/p>\n<p>  # \u5b9a\u4e49\u5907\u4efd\u6587\u4ef6\u7684\u5b58\u50a8\u8def\u5f84\u53ca\u6587\u4ef6\u540d<br \/>  DESTFILE=&quot;$BACKUP_DST\/$NOW.tar.gz&quot;<\/p>\n<p>  # \u5907\u4efdmysql\u6570\u636e\u5e93<br \/>  mysqldump -u $MYSQL_USER -h $MYSQL_SERVER -p$MYSQL_PASS &#8211;databases $BACKUP_DATABASE &gt; $NOW-Databases.sql<\/p>\n<p>  # \u5c06\u5907\u4efd\u7684\u76ee\u5f55\u548c\u5907\u4efd\u7684mysql\u6570\u636e\u5e93\u6253\u5305\u6210\u4e00\u4e2a\u538b\u7f29\u5305\u5e76\u52a0\u5bc6<br \/>  tar cfz &#8211; $BACKUP_SRC $NOW-Databases.sql | openssl des3 -salt -k PASSWORD -out $DESTFILE<\/p>\n<p>  # \u4f7f\u7528rclone\u4e0a\u4f20\u5230google drive<br \/>  rclone copy $DESTFILE $GD_PATH<\/p>\n<p>  # \u5220\u9664\u672c\u5730\u7684\u4e34\u65f6\u6587\u4ef6<br \/>  rm -f $NOW-Databases.sql $DESTFILE<\/p>\n<p>  # \u5220\u966410\u5929\u524d\u7684\u5907\u4efd<br \/>  #rclone delete $GD_PATH\/$OLD.tar.gz\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u7f8a\u6bdb\u515a<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u65e0\u8bed\u4e86\uff0clinux\u5b9a\u65f6\u8fd0\u8425\u811a\u672c\uff0c\u4f60google\u4e00\u4e0b\u51e0\u4e07\u9875\uff0c\u592a\u6c34\u4e86\u3002\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>angus1220<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u7f8a\u6bdb\u515a \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2020-4-4 20:14<br \/>  \u65e0\u8bed\u4e86\uff0clinux\u5b9a\u65f6\u8fd0\u8425\u811a\u672c\uff0c\u4f60google\u4e00\u4e0b\u51e0\u4e07\u9875\uff0c\u592a\u6c34\u4e86\u3002<\/p>\n<p> \u6211\u77e5\u9053\u7528 crontab <br \/>  rcloneflag\u67e5\u4e0d\u5230  \t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u7f8a\u6bdb\u515a<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tangus1220 \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2020-4-4 20:15<br \/>  \u6211\u77e5\u9053\u7528 crontab <br \/>  rcloneflag\u67e5\u4e0d\u5230<\/p>\n<p> \u628arclone copy xxx: gdrive:\u5199\u6210\u4e00\u4e2a\u811a\u672cyc022t<br \/>  \u7136\u540e crontab\u5b9a\u671f\u6267\u884c\u811a\u672c\u2026\u2026\u5c31\u884c\u4e86\u3002<br \/>  \u6211\u662f\u8fd9\u4e48\u64cd\u4f5c\u7684\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>angus1220<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u7f8a\u6bdb\u515a \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2020-4-4 21:11<br \/>  \u628arclone copy xxx: gdrive:\u5199\u6210\u4e00\u4e2a\u811a\u672c<br \/>  \u7136\u540e crontab\u5b9a\u671f\u6267\u884c\u811a\u672c\u2026\u2026\u5c31\u884c\u4e86\u3002<br \/>  \u6211\u662f\u8fd9\u4e48\u64cd\u4f5c\u7684 &#8230;<\/p>\n<p> \u60f3\u8981gd<br \/>  \u5206\u6bcf\u65e5\u4e00\u4e2a\u8d44\u6599\u5939\u540c\u65e5\u671f\u8fd9\u6837 \u4e0d\u592a\u4f1a\u8868\u8fbe\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>llyang<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u7f8a\u6bdb\u515a \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2020-4-4 21:11<br \/>  \u628arclone copy xxx: gdrive:\u5199\u6210\u4e00\u4e2a\u811a\u672c<br \/>  \u7136\u540e crontab\u5b9a\u671f\u6267\u884c\u811a\u672c\u2026\u2026\u5c31\u884c\u4e86\u3002<br \/>  \u6211\u662f\u8fd9\u4e48\u64cd\u4f5c\u7684 &#8230;<\/p>\n<p> myDate=$(date +&quot;%Y%m%d&quot;)<br \/>  echo $myDate<\/p>\n<p>  \u5f97\u5230<br \/>  20200404  \t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>wop<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u7f8a\u6bdb\u515a \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2020-4-4 22:03<br \/>  \u4f60\u8981\u7684\u7528\u65e5\u671f\u6807\u9898\u6587\u4ef6\u5939\u2026\u2026\u5c31\u662f\u7528\u65e5\u671f\u53c2\u6570\u521b\u5efa\u6587\u4ef6\u5939\uff0c\u770b\u4e86\u4e0b\u9762\u7684\u811a\u672c\u5185\u5bb9\uff0c\u4f60\u5e94\u8be5\u4f1a\u7684 \u3002<\/p>\n<p> \u76f4\u63a5\u6284\u80fd\u7528\u5417\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>clcavril<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tteddy sun\u6709\u811a\u672c\uff0c\u6539\u6539\u53c2\u6570\u5c31\u5b8c\u4e8b\u513f\u4e86\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u590f\u751f\u554a<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\trclone copy a: b:$(date &quot;+%Y-%m-%d&quot;)\t\t\t  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>angus1220 \u5927\u4f6c\u6709\u8bdd\u8bf4 :&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/57335"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=57335"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/57335\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=57335"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=57335"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=57335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}