Gitlab Community Edition Instance
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bnachtw
TSM-Scripts
Commits
cfde6bfa
Commit
cfde6bfa
authored
Apr 22, 2022
by
Bjoern Nachtwey
Browse files
severals changed for v0.2
parent
bd3d7533
Changes
1
Hide whitespace changes
Inline
Side-by-side
Backup/backup-SNFS.sh
View file @
cfde6bfa
...
...
@@ -24,22 +24,33 @@
#
##############################################################################
#
# Abbreviations:
# CFL(s) = Changed Files List(s)
#
# changelog
# date version remark
# 2022-03-xx 0.0 initial coding just using file list
# 2022-03-16 0.1 add some more approaches
# 2022-03-31 0.2 add analysis of output file for statistics
# 2022-04-21 0.2.1 add check for empty inc / exp-file
# 2022-04-21 0.2.2 add check for CFLs within the last 24 hours
# 2022-04-21 0.2.3 add check if statsfile exits and write header if not
# 2022-04-22 0.2.4 add "Abbreviations" section to changelog
# improved check for existing CFLs: need to have at least 23 lists within the last 24 hours
# implement "baserc" / backuprc + expirerc for CFL approach
# implement new rc if CFL files are missing with the last 24h
# get current date
today
=
$(
date
+
"%F"
)
;
fsname
=
$1
;
# Name of Filesystem as mounted below "/stornext"
fsname
=
$1
;
# Name of Filesystem as mounted below "/stornext"
bpath
=
/stornext/
$fsname
# path to it
kind
=
$2
;
# switch for using "-incrbydate" option
baserc
=
0
;
# used for calculating the rc in case of missing changed files lists
optfile
=
/StorNext-Backup/opt/
$fsname
.opt
templogfile
=
/StorNext-Backup/
$fsname
/backup.log
logfile
=
/StorNext-Backup/
$fsname
/
$today
.backup.log
statfile
=
/StorNext-Backup/
$fsname
/cfl.stats
daysback
=
10
## function for getting the Multiplier of the data amounts
...
...
@@ -62,7 +73,7 @@ export LANG=en_US
cd
/StorNext-Backup/
$fsname
/
#
# do backup
# do backup
case
"
$kind
"
in
I
)
# Standard incremental backup
/opt/tivoli/tsm/client/ba/bin/dsmc i
-optfile
=
$optfile
>
$templogfile
...
...
@@ -78,7 +89,7 @@ D) # use dsmci.pl for parallel backup
perl
-f
/StorNext-Backup/bin/dsmci.pl
rc
=
$?
;
;;
F
)
# use filelist backup
F
)
# use filelist backup
generated for StorNext file systems
infile
=
$today
.reduced
newfile
=
$today
.new
chgfile
=
$today
.chg
...
...
@@ -89,7 +100,21 @@ F) # use filelist backup
tinfile
=
$today
.tin
expfile
=
$today
.exp
# cat last three day's changelist to input file
# create empty input files
touch
$incfile
;
touch
$expfile
;
# check if enough CFL files are generated within the last 24h
numlists
=
$(
find
-L
$bpath
-maxdepth
1
-name
"*_chglst.json"
-mtime
-1
|
wc
-l
)
if
[[
$numlists
-lt
23
]]
then
baserc
=
100
;
else
baserc
=
0
;
fi
# cat last couple of days' changelists to input file
cat
$(
find
-L
$bpath
-maxdepth
1
-name
"*_chglst.json"
-mtime
-
$daysback
)
>
$infile
# grep "DOmain" options from optfile
...
...
@@ -128,20 +153,35 @@ F) # use filelist backup
# run Backups
starttime
=
$(
date
+%s.%N
)
/opt/tivoli/tsm/client/ba/bin/dsmc INCremental
-filelist
=
$incfile
-optfile
=
$optfile
>
$templogfile
# get backup rc
rc
=
$?
;
grep
"ANS4037E"
/StorNext-Backup/log/
$fsname
.error.log |
cut
-f2
-d
"'"
>
missed_files
if
[[
-s
$incfile
]]
then
/opt/tivoli/tsm/client/ba/bin/dsmc INCremental
-filelist
=
$incfile
-optfile
=
$optfile
>
$templogfile
# get backup rc
backuprc
=
$?
;
grep
"ANS4037E"
/StorNext-Backup/log/
$fsname
.error.log |
cut
-f2
-d
"'"
>
missed_files
else
backuprc
=
0
;
fi
# run File Expiration
/opt/tivoli/tsm/client/ba/bin/dsmc EXPire
-filelist
=
$expfile
-optfile
=
$optfile
-noprompt
# skip expire rc
# get runtime of all
duration
=
$(
echo
"
$(
date
+%s.%N
)
-
$starttime
"
| bc
-l
)
if
[[
-s
$expfile
]]
then
/opt/tivoli/tsm/client/ba/bin/dsmc EXPire
-filelist
=
$expfile
-optfile
=
$optfile
-noprompt
expirerc
=
$?
;
fi
# skip expire rc as missing files lead to "rc=12"
# get runtime of all
duration
=
$(
echo
"
$(
date
+%s.%N
)
-
$starttime
"
| bc
-l
)
# get & write stats
echo
$today
"; "
$rc
$(
wc
-l
$today
.??? |
awk
'{print "; " $1 }'
|
tr
"
\n
"
" "
)
";"
$duration
>>
cfl.stats
# determine total RC
rc
=
$(
echo
"
$baserc
+
$(
echo
$((
$numlists
>
$backuprc
?
$numlists
:
$backuprc
))
)
"
| bc
-l
)
;
# get & write stats
if
[[
!
-s
$statfile
]]
then
echo
"date ; chg ; del ; exp ; inc; new ; rnn ; ron ; total ; time [Sec]"
>
$statfile
fi
echo
$today
"; "
$backuprc
$(
wc
-l
$today
.??? |
awk
'{print "; " $1 }'
|
tr
"
\n
"
" "
)
";"
$duration
>>
$statfile
# remove temporary files
rm
-f
$today
.
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment