Gitlab Community Edition Instance

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

copy-instance-vpd.sh

parent d66e5656
#! /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
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