Last update at :2024-05-08,Edit by888u
Gdrive, a CLI tool for uploading and downloading Google Drive files under Linux, is simple to install and easy to use.
1. Install Gdrive: (under SSH, based on centos 7) 1. Installation
wget -O /usr/bin/gdrive "https://docs.google.com/uc?id=0B3X9GlR6EmbnQ0FtZmJJUXEyRTA&export=download" chmod +x /usr/bin/gdrive2. Authorization
gdrive aboutA string of URLs will then appear and ask for a verification code
Paste the address into the browser and log in to the account, a string of codes will be returned
Paste the code into SSH and your account information will be returned
The gdrive program will automatically save your token in the .gdrive directory under the user directory, so remember to delete this file if you no longer need it
2. Use the common commands as follows. For more information, check the gdrive official website; gdrive lists the files and folders in the root directory of Google Drive
gdrive listDownload the file in the root directory of Google Drive to the local (xxxx is the file name)
gdrive download xxxxDownload the folder in the root directory of Google Drive to local (xxx is the folder name)
gdrive download xxxUpload local files to the root directory of Google Drive (xxxx is the file name)
gdrive upload xxxxCreate a folder in the root directory of Google Drive (xxx is the folder name)
gdrive mkdir xxx3. Create a website automatic backup script and upload files to Google Drive 1. Website automatic backup script (based on Mysql database) script download: googledrive.sh Modify the following parts: Line 3: my-database-name is changed to your own database Line 4 of the name: my-database-user. Change it to your own database user name. Line 5: my-database-password. Change it to the password corresponding to your database user name. Line 7: Let’s change it to line 8 of our website directory. :/home/wwwroot Change to the directory where your website is located (that is, the backup directory needs to be /home/wwwroot/us) Line 9: /backups Change to the backup file storage directory Line 35: youremail@yourdomain.com Change to your own Email
2. Change permissions
chmod +x googledrive.sh3. Create scheduled tasks
vi /etc/crontabAdd
0 2 * * * /backups/googledrive.shThe above backup scripts are stored under /backups/. Backup and restart crontab at 2 o'clock every day
/etc/init.d/crond restart4. The application can be used in conjunction with the following blog post to make more reasonable use of resources. Use Tumblr crawler, combine with h5ai to create private video library and gallery, use VPS to create Tumblr parsing station, VPS to install Nextcloud, share Google Drive, BT download
Recommended site search: Japanese proxy server IP, Hong Kong vps host, jsp space, American asp space, virtual host space, query domain name, what is the domain name server, dual-line host rental, server rental, Shandong website registration,
发表评论