easy backup system

Today I was sitting and I thought that I should start doing regular backups on my server and these schemes that I use in my work do not work for me. – just too much functionality and I don't need to keep track of which backups from which day is that I can delete them before 2 weeks ago and so on 😉 I just need something that can just back up a few folders and delete old things 🙂 Done for about 5 min I shouted not very beautiful bash script I want to say that I am not a master 😉

 #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

overall the script is more than elementary clean and just deletes everything in the backup folder which i know will be tgz archives 🙂 and then does 2 new съм I gave more slip that the professor needs to think real time for backup is about 10 sec but i won't rewrite it 100 times hihihihihih 😉 the script itself I slammed it into /sbin the visibility folder, then I whipped the following line in /var/spool/cron/crontabs/root

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

which provides me with daily backups in 5:01 every morning що a good time to harass the crate In general, the script does not shine with genius, but on the other hand it is functional and does exactly what I want 😉 Maybe in the future I will divide the backup into www and mysql because after all one content is enough more static than the other and say one backup a week or even 2 is more than enough while SQL needs daily if the system is loaded(which is not mine) every hour

Leave a Reply

Your email address will not be published.

Anti SPAM *