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
f3118739
Commit
f3118739
authored
Nov 04, 2021
by
Bjoern Nachtwey
Browse files
copy-instance-vpd.sh
parent
d66e5656
Changes
1
Hide whitespace changes
Inline
Side-by-side
Server-Maintenance/copy-instance-vpd.sh
0 → 100644
View file @
f3118739
#! /bin/bash
##############################################################################
#
# copy-instance-vpd.sh
#
# script for copying vital instance files to DRM share
#
# (C) 2020, 2021 GWD Göttingen, Bjørn Nachtwey
# mailto:bjoern.nachtwey@gwdg.de
#
##############################################################################
#
# changelog
# date version remark
# 2020-someday 0.1 initial coding
# 2021-someday 0.1.1 put to gitlab
# 2021-04-29 0.2 add heading, replaced absolute path by variables
# added /etc/fstab to vital files
# 2021-10-20 0.2.1 fixed rsync, did not copy all files due to "*"
# changed find from -ctime to -mtime
# 2021-10-22 0.3 moved rsync to different script
#
##############################################################################
# expect $1 as username of instance user
# check if argument is given at all
if
[
-z
"
$1
"
]
then
echo
"No instance name given!"
echo
"usage:
$0
<Name / ID of instance owner>"
echo
"ABORT!"
exit
fi
# check if instance is located on this server
if
[
!
$(
grep
$1
/etc/passwd
)
]
then
echo
"wrong instance name given!"
echo
"ABORT!"
exit
fi
# get date for logfiles
today
=
$(
date
+
"%F"
)
# convert username to lowcase and upcase
luser
=
$(
echo
$1
|
tr
'[:upper:]'
'[:lower:]'
)
;
uuser
=
$(
echo
$1
|
tr
'[:lower:]'
'[:upper:]'
)
;
# some path settings
DRMdestpath
=
"/tsmshare/DRM/
$luser
"
;
set
-x
# check for folders
if
[
!
-d
$DRMdestpath
]
then
mkdir
-p
$DRMdestpath
;
fi
#################################
# copy / sync vital instance files
#################################
# rsync options
# -c checksum instead of timestamp
# -t preserve timestamp
# -u update only
#
# copy instance config files
rsync
-ctu
/
$luser
/config/cert.crl
$DRMdestpath
/
rsync
-ctu
/
$luser
/config/cert.kdb
$DRMdestpath
/
rsync
-ctu
/
$luser
/config/cert.rdb
$DRMdestpath
/
rsync
-ctu
/
$luser
/config/cert.sth
$DRMdestpath
/
rsync
-ctu
/
$luser
/config/cert256.arm
$DRMdestpath
/
rsync
-ctu
/
$luser
/config/dbvolumes
$DRMdestpath
/
rsync
-ctu
/
$luser
/config/devconf.dat
$DRMdestpath
/
rsync
-ctu
/
$luser
/config/dsmkeydb.kdb
$DRMdestpath
/
rsync
-ctu
/
$luser
/config/dsmkeydb.sth
$DRMdestpath
/
rsync
-ctu
/
$luser
/config/dsmserv.opt
$DRMdestpath
/
rsync
-ctu
/
$luser
/config/tsmdbmgr.opt
$DRMdestpath
/
rsync
-ctu
/
$luser
/config/volhist.dat
$DRMdestpath
/
#
# copy also some files from host
#
rsync
-ctu
/etc/fstab
$DRMdestpath
/
$(
hostname
)
.fstab
# get Repos & packages
.
/etc/os-release
if
[
"
$NAME
"
=
"Ubuntu"
-o
"
$NAME
"
=
"Debian GNU/Linux"
]
then
dpkg
--get-selections
>
$DRMdestpath
/packages.dpkg
rsync
-ctu
/etc/apt/source.list
$DRMdestpath
/
rsync
-ctu
/etc/apt/source.dat
$DRMdestpath
/
elif
[
"
$NAME
"
=
"SLES"
]
then
zypper lr
-d
>
$DRMdestpath
/repos.zypper
zypper search
-if
>
$DRMdestpath
/packages.zypper
fi
\ No newline at end of file
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