Benutzer-Werkzeuge

Webseiten-Werkzeuge


run_keepass_sync.sh

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
run_keepass_sync.sh [2021/02/18 11:17]
dwadmin
run_keepass_sync.sh [2021/05/27 07:38] (aktuell)
dwadmin Scriptcode aktuaisiert
Zeile 82: Zeile 82:
 ####################### #######################
 # #
-USER_TMP_DIR="/home/michael/tmp" +USER_TMP_DIR="$HOME/tmp" 
-KEEPASS_DIR="/home/michael/Daten/Privat/Keepassxc"+KEEPASS_DIR="$HOME/Daten/Privat/Keepassxc"
 KEEPASS_BACKUP_DIR="$HOME/Daten/Privat/Keepassxc_Sicherheitskopie" KEEPASS_BACKUP_DIR="$HOME/Daten/Privat/Keepassxc_Sicherheitskopie"
 KEEPASS_FILE="PasswortDatenbank.kdbx" KEEPASS_FILE="PasswortDatenbank.kdbx"
-KEEPASS_LOGFILE=/home/michael/tmp/$(basename $0).log+KEEPASS_LOGFILE=$HOME/tmp/$(basename $0).log
 SOURCE_HOST=$(hostname) SOURCE_HOST=$(hostname)
 DESTINATION_HOST=$1 DESTINATION_HOST=$1
-DUMMY_FILE="/home/michael/tmp/dummy.txt" +DUMMY_FILE="$HOME/tmp/dummy.txt" 
-LOGO_FILE="/home/michael/project/run_keepass_sync.png"+LOGO_FILE="$HOME/project/run_keepass_sync.png"
 # #
 # Fuer einen passwortlosen ssh-Zugang ist ein eigener rsa-Key erforderlich # Fuer einen passwortlosen ssh-Zugang ist ein eigener rsa-Key erforderlich
 # (id_rsa_pwdless* und config.pwdless), sowie ein ssh Configfile in ~/.ssh # (id_rsa_pwdless* und config.pwdless), sowie ein ssh Configfile in ~/.ssh
 # #
-SSH_CONFIG_FILE="/home/michael/.ssh/config.pwdless"+SSH_CONFIG_FILE="$HOME/.ssh/config.pwdless"
 # #
 ################ ################
Zeile 115: Zeile 115:
  touch $KEEPASS_LOGFILE  touch $KEEPASS_LOGFILE
  print_timestamp start  print_timestamp start
- echo "[$(date '+%H:%M:%S')] Logfile $KEEPASS_LOGFILE angelegt (1)" >> $KEEPASS_LOGFILE+ echo "[$(date '+%H:%M:%S')] Logfile $KEEPASS_LOGFILE angelegt am $(date '+%d.%m.%Y'(1)" >> $KEEPASS_LOGFILE
  else  else
  touch $KEEPASS_LOGFILE  touch $KEEPASS_LOGFILE
- echo "[$(date '+%H:%M:%S')] Logfile $KEEPASS_LOGFILE angelegt (2)" >> $KEEPASS_LOGFILE+ echo "[$(date '+%H:%M:%S')] Logfile $KEEPASS_LOGFILE angelegt am $(date '+%d.%m.%Y'(2)" >> $KEEPASS_LOGFILE
  fi  fi
 } }
Zeile 206: Zeile 206:
 { {
  # Synchronisation anstossen via rsync  # Synchronisation anstossen via rsync
- echo "" >> $KEEPASS_LOGFILE + echo "[$(date '+%H:%M:%S')] Synchronistaion der Passwort-Datenbank $KEEPASS_FILE nach Zielrechner $DESTINATION_HOST startet ..." >> $KEEPASS_LOGFILE
- echo "Synchronistaion der Passwort-Datenbank $KEEPASS_FILE nach Zielrechner $DESTINATION_HOST startet ..." >> $KEEPASS_LOGFILE+
  rsync -v -r -c -g -p -t -l -H -b --backup-dir=$KEEPASS_BACKUP_DIR --delete --stats --progress  -e 'ssh -F '$SSH_CONFIG_FILE'' $KEEPASS_DIR/$KEEPASS_FILE $USER@$DESTINATION_HOST:$KEEPASS_DIR/ >> $KEEPASS_LOGFILE  rsync -v -r -c -g -p -t -l -H -b --backup-dir=$KEEPASS_BACKUP_DIR --delete --stats --progress  -e 'ssh -F '$SSH_CONFIG_FILE'' $KEEPASS_DIR/$KEEPASS_FILE $USER@$DESTINATION_HOST:$KEEPASS_DIR/ >> $KEEPASS_LOGFILE
  RC=$?  RC=$?
Zeile 285: Zeile 284:
  if [ "$TS_VALUE" = "start" ]  if [ "$TS_VALUE" = "start" ]
  then  then
- echo "[$(date '+%H:%M:%S')] ------------------------------ Start ------------------------------" >> $KEEPASS_LOGFILE+ echo "[$(date '+%H:%M:%S')] ----------------------------------------------------- Start -----------------------------------------------------" >> $KEEPASS_LOGFILE
  elif [ "$TS_VALUE" = "end" ]  elif [ "$TS_VALUE" = "end" ]
  then  then
- echo "[$(date '+%H:%M:%S')] ------------------------------ Ende -------------------------------" >> $KEEPASS_LOGFILE+ echo "[$(date '+%H:%M:%S')] ----------------------------------------------------- Ende ------------------------------------------------------" >> $KEEPASS_LOGFILE
  fi  fi
 } }
run_keepass_sync.sh.txt · Zuletzt geändert: 2021/05/27 07:38 von dwadmin