sh 使用Google云端硬盘备份服务器文件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 使用Google云端硬盘备份服务器文件相关的知识,希望对你有一定的参考价值。

# ref: https://github.com/prasmussen/gdrive

# prerequisite:
#  In google drive, setup your folder for storing the backups
#  Then grab the code from the url e.g. https://drive.google.com/drive/folders/xxxxx where xxxxx is the code
#  This code will be used later in the cron command, keep it secret, keep it safe

# install gdrive sync for backups
wget https://drive.google.com/uc?id=0B3X9GlR6EmbnQ0FtZmJJUXEyRTA -O /usr/local/bin/gdrive
chmod 755 /usr/local/bin/gdrive

# setup connection (this will ask you to visit a url in your browser and accept permissions for gdrive, then it'll give you an access code you copy and paste back over in the terminal)
gdrive about

# setup files to be backed up as links into a /backup directory
# e.g. to backup a few core log files: 
mkdir /backup
ln /var/log/auth.log /backup
ln /var/log/syslog /backup
ln /var/log/mysql/error.log /backup
ln /var/log/nginx/error.log /backup
ln /var/log/php7.0-fpm.log /backup
# ** worth spening a little time reviewing what you want to backup **

# use cron to regularly sync /backup directory
crontab -e
# add the following
@daily /usr/local/bin/gdrive sync upload --delete-extraneous /backup xxxxx > /dev/null

以上是关于sh 使用Google云端硬盘备份服务器文件的主要内容,如果未能解决你的问题,请参考以下文章

sh 用于从Google云端硬盘下载文件的Shell脚本。

CryptoLocker - 使用 Google Apps 脚本恢复云端硬盘文件版本

Google云端硬盘,在特定文件夹中自动删除超过7天的文件

选择性同步Google云端硬盘用于本地文件夹?

google 云端硬盘中的文件无法下载

text 全部备份到Google云端硬盘/ Box / OneDrive / Dropbox无效