Commit 3be6518c authored by Bjoern Nachtwey's avatar Bjoern Nachtwey
Browse files

many changes + initial coding

parent b0455c75
#! /bin/bash
today=$(date "+%F" -d yesterday)
export LANG=en_US
export LC_ALL=en_US
## settings
# initial path
......@@ -7,7 +9,8 @@ bpath=/mnt/oc_stor_userdata
optfile=/tsm/owncloud.opt
# number of parallel jobs
numjobs=5
numjobs=25
chunknum=$(expr $numjobs \* 10)
##
......@@ -26,8 +29,7 @@ else
fi
# get latest filelist
#filelist=$(ls -d $bpath/tsm/GWDG_owncloud_incremental_filelist_$today* )
filelist=$(ls -d tfilelist )
filelist=$(ls -d $bpath/tsm/GWDG_owncloud_incremental_filelist_$today* )
if [[ ! $filelist ]]
then
......@@ -40,22 +42,14 @@ fi
##
## split file list
##
#split $filelist -d -a3 -n r/$numjobs chunk.
split -d -a3 -n r/$numjobs $filelist chunk.
split -d -a3 -n r/$chunknum $filelist chunk.
##
## do parallel backup
##
for i in $(ls chunk.*)
do
echo dsmc incr -filelist=$i -snapshotroot=$ssr -optfile=$optfile -errorlogname=errlog.$i >> $i.log
done
ls chunk* | parallel -j $numjobs --results $today dsmc sel -filelist={} -snapshotroot=$ssr -optfile=$optfile -errorlogname=$today/errlog.{}
##
## clean up
##
# rm -f chunk.*
rm -f chunk.*
#! /bin/bash
#
# 1. check if script is already running (check for PID file)
# 2. umount snapshot if mounted
# 3. check for snapshot on NetApp
# 4. delete if already existing
# 5. create new one
# 6. create new PID file
# 7. run backup using dsmci.pl
# 8. umount snapshot
# 9. remove snapshot
## some settings
# 1. check if script is already running (check for PID file)
# 2. umount snapshot if mounted
# 3. check for snapshot on NetApp
# 4. delete if already existing
# 5. create new snapshot
# 6. mount snapshot
# 7. create new PID file
# 8. run backup using dsmci.pl
# 9. umount snapshot
# 10. remove snapshot
###########################################################
# some settings
###########################################################
# pid file
pidfile=/var/run/OC-weekly.pid
# mountpoint
mp=/mnt/oc_stor_userdata
......@@ -18,50 +25,79 @@ mp=/mnt/oc_stor_userdata
snp="svm-gwdg.top.gwdg.de:/vol_GWDG_owncloud_ng/.snapshot/tsm"
# E-Mail
email="tsm-team@gwdg.de"
#email="tsm-team@gwdg.de"
email="bnachtw@gwdg.de"
# NetApp settings
# vserver=svm-gwdg.top.gwdg.de
# volume=vol_GWDG_owncloud_ng
# snapshot=tsm
# uid=
# sshkey=
## 1
###########################################################
# doing the backup
###########################################################
## 1 -- check if script is already running (check for PID file)
if [[ -s $pidfile ]]
then
echo "PID file for OC-weekly found! ABORT!" | mail -s "OC-Backup: PID file for OC-weekly found" $email
exit 1;
fi
## 2 -- check if mountpoint is already used / blocked and umount if so
## 2 -- check if mountpoint is already used / blocked and umount if so
if [[ $(mount | grep $mp) ]]
then
umount $mp
fi
if [[ $(mount | grep $mp) ]]
then
echo "cannot umount snapshot! ABORT" | mail -s "OC-Backup: Cannot umount Snapshot" tsmteam@gwdg.de
exit 15
echo "cannot umount snapshot! ABORT" | mail -s "OC-Backup: Cannot umount Snapshot" $email
exit 2
fi
## 3
## 3 -- check for snapshot on NetApp
## 4
## 4 -- delete if already existing
## 5
## 5 -- create new snapshot
## 6 -- create new PID file
echo
# intially mount the actual backup snaphot
## 6 -- mount snapshot
mount.nfs $snp $mp
if [[ $(mount | grep $mp) ]]
if [[ ! $(mount | grep $mp) ]]
then
echo "mount successful!"
echo "Cannot mount Snapshot! ABORT!" | mail -s "OC-Backup: Cannot mount Snapshot" $email
rm -f $pidfile
exit 6
fi
## 7 -- create new PID file
echo $$ > $pidfile
perl -f dsmci.pl
## 8 -- run backup using dsmci.pl
if [[ -s dsmci.pl ]]
then
echo perl -f dsmci.pl
else
echo "Cannot find dsmci.pl! ABORT!" | mail -s "Cannot find ./dsmci.pl" $email
rm -f $pidfile
umount $mp
exit 8
fi
# umount when ready
## 9 -- umount snapshot
umount $mp
if [[ ! $(mount | grep $mp) ]]
if [[ $(mount | grep $mp) ]]
then
echo "umount successful :-)"
else
echo "umount failed!"
exit 2;
echo "Umount failed! ABORT!" | mail -s "Cannot umount Snapshot" $email
exit 9
fi
exit 0;
### 10 -- remove snapshot
### All done
exit 0
#! /bin/bash
today=$(date "+%F")
umount /mnt/oc_stor_userdata
mount svm-gwdg.top.gwdg.de:/vol_GWDG_owncloud_ng /mnt/oc_stor_userdata
if [[ ! -d $today ]]
then
mkdir $today
fi
time $(bash OC-daily-selective-backup.sh >> $today/out.log) | tee $today/times.log
# get total
echo Total number of objects inspected: $(grep "Total number of objects inspected" $today/out.log | sed -e 's/,//g' | awk -F ':' '{sum+=$2} END {print sum}')
echo Total number of objects backed up: $(grep "Total number of objects backed up" $today/out.log | sed -e 's/,//g' | awk -F ':' '{sum+=$2} END {print sum}')
echo Total number of objects updated : $(grep "Total number of objects updated" $today/out.log | sed -e 's/,//g' | awk -F ':' '{sum+=$2} END {print sum}')
echo Total number of objects failed : $(grep "Total number of objects failed" $today/out.log | sed -e 's/,//g' | awk -F ':' '{sum+=$2} END {print sum}')
echo ANS4005 errors : $(grep ANS4005E $today/out.log | wc -l)
umount /mnt/oc_stor_userdata
#! /bin/bash
today=$(date "+%F" -d yesterday)
umount /mnt/oc_stor_userdata
mount svm-gwdg.top.gwdg.de:/vol_GWDG_owncloud_ng /mnt/oc_stor_userdata
if [[ ! -d $today ]]
then
mkdir $today
fi
time $(bash OC-daily-selective-backup.sh >> $today/out.log) | tee $today/times.log
# get total
echo Total number of objects inspected: $(grep "Total number of objects inspected" $today/out.log | sed -e 's/,//g' | awk -F ':' '{sum+=$2} END {print sum}')
echo Total number of objects backed up: $(grep "Total number of objects backed up" $today/out.log | sed -e 's/,//g' | awk -F ':' '{sum+=$2} END {print sum}')
echo Total number of objects updated : $(grep "Total number of objects updated" $today/out.log | sed -e 's/,//g' | awk -F ':' '{sum+=$2} END {print sum}')
echo Total number of objects failed : $(grep "Total number of objects failed" $today/out.log | sed -e 's/,//g' | awk -F ':' '{sum+=$2} END {print sum}')
echo ANS4005 errors : $(grep ANS4005E $today/out.log | wc -l)
umount /mnt/oc_stor_userdata
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