HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Tips/Tricks/Mods (http://www.howtoforge.com/forums/forumdisplay.php?f=19)
-   -   Aner Backup script for Ispconfig 2 (http://www.howtoforge.com/forums/showthread.php?t=51917)

trexen 17th March 2011 10:20

Aner Backup script for Ispconfig 2
 
I just whant to share my backupscript.
it backup all dir under /var/www/ to separate tar files whit todays date.

--------------------------------------------
#!/bin/bash
work_dir="/var/www/"
bkup_dir="/mnt/backup/www/"
date=`date +%Y%m%d`

cd $work_dir
for file in `\ls -1dt web*`
do
echo \"$file\";
tar pczf $bkup_dir$file-$date.tgz $work_dir$file/
done
----------------------------------------------------

enjoy
regards
Marcus


if you like to auto remove backup after 30 days add this into the script:

days_to_keep=30
#remove old files, older than 30 days
echo "Deleting old archives from $bkup_dir"
find $bkup_dirweb* -type f -mtime +$days_to_keep -exec rm {} \;


All times are GMT +2. The time now is 00:27.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.