Commit 8197879e authored by Bjoern Nachtwey's avatar Bjoern Nachtwey
Browse files

some fixes due to change of working dir, different log / stats file

parent c0f6ec1d
#! /bin/bash
##
## settings
##
# initial path
bpath=/mnt/oc_stor_userdata
optfile=/tsm/ocnode/owncloud.opt
# number of parallel jobs
numjobs=25
chunknum=$(expr $numjobs \* 10)
# check for given date as $1
if [[ $1 ]]
then
......@@ -8,22 +19,13 @@ else
today=$(date "+%F")
fi
# create today's folder and switch to it
# create $today's folder and switch to it
if [[ ! -d $today ]]
if [[ ! -d /tsm/ocnode/$today ]]
then
mkdir $today
mkdir /tsm/ocnode/$today
fi
cd $today
## settings
# initial path
bpath=/mnt/oc_stor_userdata
optfile=/tsm/ocnode/owncloud.opt
# number of parallel jobs
numjobs=25
chunknum=$(expr $numjobs \* 10)
cd /tsm/ocnode/$today
##
## check for snapshot and filelist
......@@ -33,21 +35,21 @@ chunknum=$(expr $numjobs \* 10)
ssr=$(ls -d $bpath/.snapshot/snap_daily.$today*)
if [[ ! $ssr ]]
then
echo "no actual daily snapshot" | tee -a out.log
echo "no actual daily snapshot" | tee -a ../$today.daily.stats
exit 2
else
echo "latest snapshot: $ssr" | tee -a out.log
echo "latest snapshot: $ssr" | tee -a ../$today.daily.stats
fi
# get latest filelist
filelist=$(ls -d $bpath/tsm/GWDG_owncloud_incremental_filelist_$today* )
filelist=$(ls -dt $bpath/tsm/GWDG_owncloud_incremental_filelist_$today* | head -n 1)
if [[ ! $filelist ]]
then
echo "no actual filelist" | tee -a out.log
echo "no actual filelist" | tee -a ../$today.daily.stats
exit 3
else
echo "latest filelist: $filelist" | tee -a out.log
echo "latest filelist: $filelist" | tee -a ../$today.daily.stats
fi
##
......@@ -58,27 +60,33 @@ split -d -a3 -n r/$chunknum $filelist chunk.
##
## do parallel backup
##
echo "----" > out.log
date >> out.log
echo "----" >> out.log
$(ls chunk* | parallel -j $numjobs --results $today dsmc seld -filelist={} -snapshotroot=$ssr -optfile=$optfile -errorlogname=errlog.{} ) >> out.log
ls chunk* | parallel -j $numjobs --results out dsmc sel -filelist={} -snapshotroot=$ssr -optfile=$optfile -errorlogname=errlog.{}
echo "----" >> out.log
date >> out.log
echo "----" >> out.log
##
## clean up
## collect stats
##
rm -f chunk.*
for i in $(find . -name "stdout")
do
grep "Total number of objects inspected" $i | sed -e 's/,//g' >> out.ti;
grep "Total number of objects backed up" $i | sed -e 's/,//g' >> out.tb;
grep "Total number of objects updated" $i | sed -e 's/,//g' >> out.tu;
grep "Total number of objects failed" $i | sed -e 's/,//g' >> out.tf;
grep "ANS4005E" $i | sed -e 's/,//g' >> out.4005E;
grep "AN[E,R,S][0..9]*S" $i | sed -e 's/,//g' >> out.ts;
done
echo Total number of objects inspected : $(awk -F ':' '{sum+=$2} END {print sum}' < out.ti) >> ../$today.daily.stats
echo Total number of objects backed up : $(awk -F ':' '{sum+=$2} END {print sum}' < out.tb) >> ../$today.daily.stats
echo Total number of objects updated . : $(awk -F ':' '{sum+=$2} END {print sum}' < out.tu) >> ../$today.daily.stats
echo Total number of objects failed .. : $(awk -F ':' '{sum+=$2} END {print sum}' < out.tf) >> ../$today.daily.stats
echo ANS4005 errors .................. : $(wc -l out.4005E | cut -f1 -d' ') >> ../$today.daily.stats
echo severe errors ................... : $(wc -l out.ts) | cut -f1 -d' ' >> ../$today.daily.stats
l
##
## collect stats
## clean up
##
echo Total number of objects inspected: $(grep "Total number of objects inspected" out.log | sed -e 's/,//g' | awk -F ':' '{sum+=$2} END {print sum}') >> ../$today.stats
echo Total number of objects backed up: $(grep "Total number of objects backed up" out.log | sed -e 's/,//g' | awk -F ':' '{sum+=$2} END {print sum}') >> ../$today.stats
echo Total number of objects updated : $(grep "Total number of objects updated" out.log | sed -e 's/,//g' | awk -F ':' '{sum+=$2} END {print sum}') >> ../$today.stats
echo Total number of objects failed : $(grep "Total number of objects failed" out.log | sed -e 's/,//g' | awk -F ':' '{sum+=$2} END {print sum}') >> ../$today.stats
echo ANS4005 errors : $(grep ANS4005E out.log | wc -l) >> ../$today.stats
rm -f chunk.*
rm -rf out/
rm -f errlog*
rm -f out.t* out.4005E
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment