easy backup system

today I sat and thought that tryavba to pochnada I make regular backups of sarvarcheto me and those circuits where I use them in my work I do not do the job – just too much functionality and do not tyarbva here to keep an eye on what backup from which day is to be able to rub ago 2 weeks ago and so 😉 tyarbva just something where I can clean just to back up a few folders and delete old things 🙂 done sooner said about 5 min natreshtyah not particularly beautiful bash script I must say that Yes, there bash craftsmen 😉

#!/bin/bash
 #path to beckup folder
 cd /media/backup

rm -r *.tgz
 sleep 3 #time for removing

#path to first folder
 /bin/tar cvzf www.tgz /var/www/
 sleep 30 #time for arhiving
 /bin/tar cvzf mysql.tgz /var/lib/mysql/
 sleep 30
 #EOF

the whole script is more than elemntaren simply delete everything in the folder backups that I know that are tgz archives 🙂 and then makes 2 New 🙂 I gave plenty sliipche that profesorcheto need to consider real-time bekaping around 10 sec but I will not rewrite it 100 times hihihihihi 😉 script itself him in plyasnah /sbin folder clarity, then whipped in the following order /var/spool/cron/crontabs/root

01 5 * * * /sbin/backuper > /dev/null

which provides me daily backups to 5:01 every morning 😉 appropriate time to fret shtaigata Overall neblesti of genius script but on behalf of that is functional and does exactly what I want 😉 Maybe in the future will divide bekapinga at www and mysql-but because still one content Dosa more static than the other and say one backup per week or even 2 more than dosatachen while SQL-Demand and its daily that if charged sisitema(whatever is not my) horary

leave a reply

Your email address will not be published. Required fields are marked *

anti SPAM *