Posted in
5465
5:26 am, May 26, 2021
backup script to google drive that can be used for multiple directories
this zips the content of the target directory and then uploads it to a google drive backup location
just create a file called ~/_backup_dir.sh and then add the following
BASH - _backup_dir.sh
tar -czvf ~/backup/$1.tar.gz /var/www/html/$1/
rclone copy ~/backup/$1.tar.gz gdrive:Backup/my.server.name
make sure you chmod +x the ~/_backup_dir.sh file
then create another file called backup_sites.sh and also chmod +x this file
Now we can list the directories we want to zip and upload to google drive.
BASH - backup_sites.sh
#files
~/_backup_dir.sh my.site.one
~/_backup_dir.sh my.site.two
and then when you add a new directory that needs to be backed up to google drive, just add it to the backup_sites.sh file and it will add it to the list.
Also if you want to have automated backups you can now add the backup_sites.sh to a crontab and specify when you want it to run to automatically backup your files.
Add this to your crontab to backup all sites daily at 8.
BASH - crontab
0 8 * * * ~/backup_all.sh > /dev/null 2>&1
⚙
View Statistics
This Week
193
This Month
644
This Year
1530
Add Comment
Other Items in linux
show all connections on linux command line
add ssh keys on your linux box in 10 seconds
Install PHP without Apache on Ubuntu
add a user and add the user to sudo group
add user to sudo group in ubuntu
simple backup to google drive fron linux
backup script to google drive that can be used for multiple directories
start ssh and add key git
play youtube videos on firefox in ubuntu 18
Creating a chart about charts.css with charts.css from the command line
linux mount a drive manually
installing exfat and ntfs drivers to enable reading of these filesystems
linux list all drives and partitions
how to check the temperature of the pi using command line
how to check linux kernel version on rasberry pi rasberian
how to find what version pi you are using
change file permissions to -rw-rw-r--
install atom editor on ubuntu
Enabling SSH on Ubuntu
certbot add a certificate for one domain
renew all SSL certificates with certbot
To make Ubuntu do nothing when laptop lid is closed
add a user to a group
loop through each directory in a target directory and compress them
loop through each directory in a target directory
tar.gz to compress a directory in linux and then decompress it
Find Disk Space Usage using DU
how to unzip in linux
Related Search Terms
Other Categories in Code
alpine js apps c css factorio font awesome images linux quick modals sqlite site bugs site updates slick slider sliders testing windows apps apache api apps asp bat bootstrap bootstrap templates charts cookies core css css filters css grid design elements docker domains emoji fancybox fonts foundation framework gimp git html icons ideas image formatting images javascript javascript functions jquery js linux mac misc modals mysql nginx node php php errors php function php functions php simple html dom pi400 python react regex sections simple_html_dom simplepie php site bugs site documentation slick slider sql sqlite ssh sublime svg svg css templates tools virtual box vscode vue webdev windows windows 11 windows commands wordpress