I'm trying to write a script to back up with rsync, the script I am posting below:
nomServer="shiva horus isis"
dirshiva="/etc /faturamento"
shivaListExc="/usr/local/bin/shivaListExclRsync"
dumpDir="$dumpFile/Shiva"
dateBkp=`date +%A`
for nServer in ${nomServer}
do
dirServer="$dirBkp/$nServer"
if [ ! -d $dirServer ]
then
mkdir $dirServer
fi
for sDir in dir${nServer}
do
rsync -C \
-D \
--recursive \
--update \
--links \
--perms \
--acls \
--xattrs \
--owner \
--group \
--times \
--verbose \
--progress \
--partial \
--numeric-ids \
--specials \
--exclude-from=${nServer}ListExc \
$nServer:$sDir $dirServer
dumpDir="$dumpFile/$nServer"
if [ ! -d $dumpDir ]
then
mkdir $dumpDir
fi
if [ ! -d $dateBkp ]
then
mkdir $dumpDir/$dateBkp
fi
tar -zcvfp --atime-preserve --remove-files /$dumpDir /$dateBkp$sDir.tar.gz /$dirServer$sDir
done
done
my question:
dirshiva="/etc /faturamento"
shivaListExc="/usr/local/bin/shivaListExclRsync"
the first variable is an array but when I called it in for is failing.
for sDir in dir${nServer}
I need this variable to return the value "dirshiva", there's any way to do this? I tried in many ways and I confess that I had no success.
if anyone has any ideas, I am grateful.
att,
Amilcar