Now On the backupserver machines
mkdir /net/serverbackup ----------> location where all the tar.gz files are stored
This scritpt will wget the flles from vairous server
vi /usr/local/bin/serverbackup
#!/bin/bash
set -x
DIR=/net/serverbackup
SERVERINFO=/net/serverbackup/serverbackupfiles
cd /net/serverbackup
if [ -d $DIR ] ;then
if [ -f $SERVERINFO ];then
for i in `cat $SERVERINFO |awk -F "|" '{print $2}'`
do
`cat $SERVERINFO |grep $i |awk -F "|" '{print $3}'``date +%Y%m%d`.tgz;
done
else
echo " serverbackupfiles does not exist "
fi
else
echo " serverbackup dir does not exist "
fi
This file (serverbackupfiles) is requied by the "serverbackup" script
cat /net/serverbackup/serverbackupfiles
|server112|wget --user=agnello --password=username http:///server112.com/serverbackup/pamserver2.
crontab -e
##for serverbackup to weget the files
0 11 * * * /usr/local/bin/serverbackup
Now On the system to be backed up
cd /net/serverbackup
ln -s /net/serverbackup /var/www/html/serverbackup
vi /usr/local/bin/serverbackupdaily
#!/bin/bash
#
set -x
backupfile1="`date '+%Y%m%d'`"
backupfile="servername.$backupfile1.tgz"
if cd /; then
tar zcf /tmp/$backupfile --exclude-from=/etc/backup/excludedaily `cat /etc/backup/BACKUPDAILY`
mv /tmp/$backupfile /net/serverbackup
chown -R web.web /net/serverbackup
fi
exit 0
vi /etc/httpd/conf/httpd.conf
#setting for serverbackup
AllowOverride AuthConfig
AuthName "serverBackup login"
AuthType Basic
AuthUserFile /net/serverbackup/.htpasswd
AuthGroupFile /dev/null
require user serverbackup
Order deny,allow
Deny from all
Allow from all
htpasswd -bc /net/serverbackup/.htpasswd serverbackup password
crontab -e
##for serverbackup
0 06 * * * /usr/local/bin/serverbackupdaily
No comments:
Post a Comment