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 {} \;
Last edited by trexen; 17th March 2011 at 15:39.
Reason: script updated
|
Recent comments
1 day 18 hours ago
1 day 20 hours ago
2 days 8 hours ago
2 days 11 hours ago
2 days 15 hours ago
2 days 21 hours ago
3 days 7 hours ago
3 days 9 hours ago
3 days 17 hours ago
3 days 18 hours ago