How to take backup of domains under vmail directory.
just follow this,
First create a script file,
eg
vi backupVmailBkp.sh
then paste all this code in that.
#################################################
#taking vmail backup
#timestamp=`date +%Y-%B-%d_%H%M%S`;
host=server1
timestamp=`date +%Y-%m-%d_%H%M%S`;
mkdir /var/backup/VmailBackups/vmailbkp-$host-$timestamp
cd /var/vmail/
ls -lah > /var/backup/VmailBackups/vmailbkp-$host-$timestamp/vmail-domain-list
echo "Starting Backup";
echo `date`;
for dir in */
do
base=$(basename "$dir")
tar -czf "${base}.tar.gz" "$dir"
mv *.gz /var/backup/VmailBackups/vmailbkp-$host-$timestamp
done
#############################################
after that change the permission of newly created file.
# chmod +x backupVmailBkp.sh
then run this,
# ./backupVmailBkp.sh
your backup will start.
0 comments:
Post a Comment