#!/bin/bash
filename=/root/fwr.sh
path=/root/backup/
shift 2
if [ ! -f ${filename} ];
then
echo "File not found!"
else
if [ ! -d ${path} ];
then
mkdir -p ${path}
fi
while [ ! -z "${path}" ] ; do
yes | cp ${filename} ${path}
path=$1
shift
done
fi
filename=/etc/rc.local
path=/root/backup/
shift 2
if [ ! -f ${filename} ];
then
echo "File not found!"
else
if [ ! -d ${path} ];
then
mkdir -p ${path}
fi
while [ ! -z "${path}" ] ; do
yes | cp ${filename} ${path}
path=$1
shift
done
fi
filename=/etc/resolv.conf
path=/root/backup/
shift 2
if [ ! -f ${filename} ];
then
echo "File not found!"
else
if [ ! -d ${path} ];
then
mkdir -p ${path}
fi
while [ ! -z "${path}" ] ; do
yes | cp ${filename} ${path}
path=$1
shift
done
fi
filename=/etc/hosts
path=/root/backup/
shift 2
if [ ! -f ${filename} ];
then
echo "File not found!"
else
if [ ! -d ${path} ];
then
mkdir -p ${path}
fi
while [ ! -z "${path}" ] ; do
yes | cp ${filename} ${path}
path=$1
shift
done
fi
filename=/etc/sysconfig/network
path=/root/backup/
shift 2
if [ ! -f ${filename} ];
then
echo "File not found!"
else
if [ ! -d ${path} ];
then
mkdir -p ${path}
fi
while [ ! -z "${path}" ] ; do
yes | cp ${filename} ${path}
path=$1
shift
done
fi
filename=/etc/sysconfig/network-scripts/*
path=/root/backup/network-scripts
shift 2
if [ ! -d ${path} ];
then
mkdir -p ${path}
fi
while [ ! -z "${path}" ] ; do
yes | cp -Rp ${filename} ${path}
path=$1
shift
done
filename=/etc/squid/*
path=/root/backup/squid
shift 2
if [ ! -d ${path} ];
then
mkdir -p ${path}
fi
while [ ! -z "${path}" ] ; do
yes | cp -Rp ${filename} ${path}
path=$1
shift
done
filename=/etc/mail/*
path=/root/backup/mail
shift 2
if [ ! -d ${path} ];
then
mkdir -p ${path}
fi
while [ ! -z "${path}" ] ; do
yes | cp -Rp ${filename} ${path}
path=$1
shift
done
filename=/var/qmail/*
path=/root/backup/qmail
shift 2
if [ ! -d ${path} ];
then
mkdir -p ${path}
fi
while [ ! -z "${path}" ] ; do
yes | cp -Rp ${filename} ${path}
path=$1
shift
done
No comments:
Post a Comment