Posted in linux
312
5:26 am, May 26, 2021
 

backup script to google drive that can be used for multiple directories

<p>this zips the content of the target directory and then uploads it to a google drive backup location</p>
<p>just create a file called ~/<strong>backupdir.sh</strong> and then add the following</p>
<h4>BASH - <strong>backupdir.sh</strong>&nbsp;</h4>
<pre><code class="html hljs xml">tar -czvf ~/backup/$1.tar.gz /var/www/html/$1/<br />rclone copy ~/backup/$1.tar.gz gdrive:Backup/my.server.name</code></pre>
<p>make sure you chmod +x the ~/<strong>backupdir.sh </strong>file</p>
<p>then create another file called <strong>backupsites.sh</strong> and also chmod +x this file</p>
<p>Now we can list the directories we want to zip and upload to google drive.</p>
<h4>BASH - backup
sites.sh</h4>
<pre><code class="html hljs xml">#files<br />~/backupdir.sh my.site.one<br />~/backupdir.sh my.site.two</code></pre>
<p>and then when you add a new directory that needs to be backed up to google drive, just add it to the backupsites.sh file and it will add it to the list.</p>
<p>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.&nbsp;</p>
<p>Add this to your crontab to backup all sites daily at 8.</p>
<h4>BASH - crontab</h4>
<pre><code class="html hljs xml">0 8 * ~/backup_all.sh &gt; /dev/null 2&gt;&amp;1</code></pre>
<p>⚙</p>

View Statistics
This Week
148
This Month
713
This Year
407

No Items Found.

Add Comment
Type in a Nick Name here
 
Other Items in linux
php error feed errors: XML or PCRE extensions not loaded! Identify which IPs are driving connections: check nginx access logs for bots show established connections in linux ubuntu check connetions in linux every 10 seconds loop Fatal error: Uncaught Error: Call to undefined function mb_strlen() blocking ip range with ufw check and block connections script block ip address ranges on ubuntu linux with UFW list all network connections 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
Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

You could also follow me on twitter. I have a couple of youtube channels if you want to see some video related content. RuneScape 3, Minecraft and also a coding channel here Web Dev.

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
Be Yourself, Back Yourself
Kristie Bennett, Survivor
Latest News
## 🚀 AI Giants Hit Bullseye: Anthropic & OpenAI Achieve Product-Market Fit Anthropic and OpenAI have reached a significant milestone, finding product-market fit with their AI technologies, which means their products effectively meet the needs of their customers, driving growth and adoption. This achievement showcases the practical value of their innovations, enabling businesses and individuals to leverage AI for enhanced productivity and efficiency. With this alignment of product and market needs, these companies are poised to transform industries and shape the future of technology.