Commit b0455c75 authored by Bjoern Nachtwey's avatar Bjoern Nachtwey
Browse files

early OC Backup scripts

parent d76edcf3
#! /bin/bash
today=$(date "+%F" -d yesterday)
## settings
# initial path
bpath=/mnt/oc_stor_userdata
optfile=/tsm/owncloud.opt
# number of parallel jobs
numjobs=5
##
## check for snapshot and filelist
##
# get latest snapshot for SNAPSHOTROOT
#ssr=$(find $bpath/.snapshot/ -maxdepth 1 -daystart -ctime 1 -name "snap_daily*")
ssr=$(ls -d $bpath/.snapshot/snap_daily.$today*)
if [[ ! $ssr ]]
then
echo "no actual daily snapshot";
exit 2
else
echo "latest snapshot: $ssr"
fi
# get latest filelist
#filelist=$(ls -d $bpath/tsm/GWDG_owncloud_incremental_filelist_$today* )
filelist=$(ls -d tfilelist )
if [[ ! $filelist ]]
then
echo "no actual filelist"
exit 3
else
echo "latest filelist: $filelist"
fi
##
## split file list
##
#split $filelist -d -a3 -n r/$numjobs chunk.
split -d -a3 -n r/$numjobs $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
##
## clean up
##
# 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
# mountpoint
mp=/mnt/oc_stor_userdata
# snapshot path
snp="svm-gwdg.top.gwdg.de:/vol_GWDG_owncloud_ng/.snapshot/tsm"
# E-Mail
email="tsm-team@gwdg.de"
## 1
## 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
fi
## 3
## 4
## 5
## 6 -- create new PID file
echo
# intially mount the actual backup snaphot
mount.nfs $snp $mp
if [[ $(mount | grep $mp) ]]
then
echo "mount successful!"
fi
perl -f dsmci.pl
# umount when ready
umount $mp
if [[ ! $(mount | grep $mp) ]]
then
echo "umount successful :-)"
else
echo "umount failed!"
exit 2;
fi
exit 0;
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