Monday, February 15, 2010

SHELL SCRIPT FOR BACKTOP

#!/bin/sh
foldername=$(date +"%Y%b-%d")
echo *******start*******
mkdir -p /home/lotus/htmlbackup/$foldername
cp -r /var/www/html/ /home/lotus/htmlbackup/$foldername/
cd /home/lotus/htmlbackup/
tar -zcvf 'localhtml_'$foldername.tar.gz $foldername
rm -rf $foldername
chown -R lotus:lotus 'localhtml_'$foldername.tar.gz
echo ********SUCCESS*********




ftp :


foldername=$(date +"%Y%b-%d")
echo *******start*******
mkdir -p /mnt/backup/$foldername
cp -r /home/ftp-docs/rpms /mnt/backup/$foldername/
cd /mnt/backup/
tar -czvf 'rpms__'$foldername.tar.gz $foldername
rm -rf $foldername
chown -R root:root 'rpms__'$foldername.tar.gz
echo ********SUCCESS*********

No comments:

Post a Comment