#dirs
confdir=/home/backup/conf/ #configuration files
-webdir=/home/backup/public_html #web-pages
storagedir=/backup #mountpoint of huge disc
###
# The computers we want to back up
unixcomputers=`cat $confdir/computers.unix`
-#ntcomputers=`cat $confdir/computers.nt`
###
#disse bør kunne varieres fra fs til fs?
-#disse bør flyttes ut i egen fil som kan editeres fra web kanskje?
maksantallfulle=2 #hvor mange fulle vi tar vare på
dagermellomfulle=30 #antall dager før det er på tide med ny full
logw=40
forrigecmd=""
fi
- #Prøver å ta backup med tar
+ #We try to run tar on the remote computer
if `ssh $computer "cd $filesystem ;\
tar cfl - . $forrigecmd \
--exclude-from=/tmp/.backup/exclude \
then
#perhaps it did work
mv $DATE.tmp $DATE.tgz
- #make a filelist and update the datefile
+ #make a filelist.
+ #update the datefile if the filelist is ok.
tar tvfz $DATE.tgz > $DATE.idx 2>&1 &&
echo $DATEs > ../.date &&
touch -t $DATE ../.date
grep -v ^d $DATE.idx | sort -n -r +2 > $DATE.sdx
#fix perm
- chmod 600 *tgz
- chmod 644 *sdx *idx 2>/dev/null
+ chmod 600 *tgz #only for us
+ chmod 644 *sdx *idx 2>/dev/null #everyone can read
else
#it did not work
mkdir -m 755 -p $storagedir/$computer/$sfilesystem/{full,daglig} 2>/dev/null
#
- echo $filesystem > $storagedir/$computer/$sfilesystem.name
- chmod 644 $storagedir/$computer/$sfilesystem.name
+ echo $filesystem > ${storagedir}/${computer}/.${sfilesystem}.name
+ chmod 644 ${storagedir}/${computer}/.${sfilesystem}.name
#set default backuplevel
backuplevel=daglig
oldf=`ls -t1 $storagedir/$computer/$sfilesystem/full/*tgz | tail -1`
find \
$storagedir/$computer/$sfilesystem/daglig \
+ -type f \
\! -newer $oldf \
-exec rm {} \;
#denne funker bare med gnu find