Compare commits
2
Commits
main
..
c64be0e9fa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c64be0e9fa | ||
|
|
788c9f07b9 |
No files matched your search
@@ -1,7 +1 @@
|
||||
redshift_on
|
||||
*.log
|
||||
*.tmp
|
||||
.DS_Store
|
||||
node_modules/
|
||||
.env
|
||||
.DS_Store
|
||||
@@ -1,38 +1,13 @@
|
||||
|
||||
Alles quatsch! Das script kann nicht mehrmals ausgeführt werden, da photoprism immer alles noch mal indiziert!!!
|
||||
Noch keine Lösung gefunden. Muss auch klappen wenn mal mehrere Tage die Bilder vom handy nicht gesynct wurden.
|
||||
|
||||
|
||||
#!/bin/bash
|
||||
# This script runs the index process of PhotoPrism.
|
||||
# it must be called from a cronjob or similar to ensure it runs periodically.
|
||||
|
||||
# Flag-Datei zur Vermeidung paralleler Ausführungen
|
||||
FLAG_FILE="/root/photoprism-auto-index.flag"
|
||||
LOG_FILE="/root/photoprism-auto-index.log"
|
||||
MAX_LOG_SIZE=$((10 * 1024 * 1024)) # 10 MB in Bytes
|
||||
MAX_FLAG_AGE=$((12 * 60 * 60)) # 12 Stunden in Sekunden
|
||||
|
||||
# Log-Funktion
|
||||
log() {
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" >> "$LOG_FILE"
|
||||
|
||||
# Prüfe Log-Größe und kürze wenn nötig
|
||||
if [ -f "$LOG_FILE" ]; then
|
||||
LOG_SIZE=$(stat -f %z "$LOG_FILE" 2>/dev/null || echo 0)
|
||||
if [ "$LOG_SIZE" -gt "$MAX_LOG_SIZE" ]; then
|
||||
# Behalte nur die letzten 50% des Logs
|
||||
tail -n 5000 "$LOG_FILE" > "$LOG_FILE.tmp"
|
||||
mv "$LOG_FILE.tmp" "$LOG_FILE"
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') - Log gekürzt (war $((LOG_SIZE / 1024 / 1024)) MB)" >> "$LOG_FILE"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Cleanup-Funktion die IMMER ausgeführt wird (auch bei Fehlern/Abbruch)
|
||||
cleanup() {
|
||||
rm -f "$FLAG_FILE"
|
||||
log "Cleanup: Flag-Datei gelöscht"
|
||||
}
|
||||
|
||||
# trap registriert die cleanup-Funktion für verschiedene Exit-Szenarien:
|
||||
@@ -42,37 +17,15 @@ cleanup() {
|
||||
# ERR = wenn ein Befehl fehlschlägt (bei set -e)
|
||||
trap cleanup EXIT INT TERM ERR
|
||||
|
||||
log "Script gestartet (PID: $$)"
|
||||
|
||||
# Prüfe ob ein anderer Prozess bereits läuft
|
||||
if [ -f "$FLAG_FILE" ]; then
|
||||
# Prüfe Alter der Flag-Datei
|
||||
FLAG_MTIME=$(stat -f %m "$FLAG_FILE" 2>/dev/null || echo 0)
|
||||
CURRENT_TIME=$(date +%s)
|
||||
FLAG_AGE=$((CURRENT_TIME - FLAG_MTIME))
|
||||
|
||||
if [ $FLAG_AGE -gt $MAX_FLAG_AGE ]; then
|
||||
log "Flag-Datei ist älter als 12h ($((FLAG_AGE / 3600))h) - lösche sie und starte neu"
|
||||
cleanup
|
||||
else
|
||||
log "Abbruch: Prozess läuft bereits (seit $((FLAG_AGE / 60)) Minuten)"
|
||||
trap - EXIT INT TERM ERR
|
||||
exit 1
|
||||
fi
|
||||
trap - EXIT INT TERM ERR
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "Erstelle Flag-Datei"
|
||||
echo "Started: $(date '+%Y-%m-%d %H:%M:%S') | PID: $$" > "$FLAG_FILE"
|
||||
|
||||
# Führe Index-Prozess aus
|
||||
log "Starte PhotoPrism Index-Prozess"
|
||||
docker exec ix-photoprism-photoprism-1 photoprism index >> "$LOG_FILE" 2>&1
|
||||
EXIT_CODE=$?
|
||||
|
||||
if [ $EXIT_CODE -eq 0 ]; then
|
||||
log "Index-Prozess erfolgreich abgeschlossen"
|
||||
else
|
||||
log "Index-Prozess fehlgeschlagen (Exit-Code: $EXIT_CODE)"
|
||||
fi
|
||||
docker exec ix-photoprism-photoprism-1 photoprism index
|
||||
|
||||
# Flag-Datei wird automatisch durch trap cleanup gelöscht
|
||||
@@ -1,39 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Dieses Skript löscht alte Nextcloud Installer Backups und verwaiste Dateien.
|
||||
# Script Version 1.0
|
||||
|
||||
user_dir="/home/boogie"
|
||||
nextcloud_backup_dir="$user_dir/nextcloud_data/updater-ockwywbvotb7/backups"
|
||||
nexcloud_program_dir="/var/www/virtual/boogie/cloud.boogiedev.net"
|
||||
|
||||
if [ ! -d "$nextcloud_backup_dir" ]; then
|
||||
echo "Verzeichnis nicht gefunden: $nextcloud_backup_dir"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Dateien in $nextcloud_backup_dir:"
|
||||
echo "-----------------------------------"
|
||||
ls -lh "$nextcloud_backup_dir"
|
||||
echo "-----------------------------------"
|
||||
|
||||
read -r -p "Alle Dateien wirklich löschen? (j/N): " bestaetigung
|
||||
|
||||
if [[ "$bestaetigung" =~ ^[jJ]$ ]]; then
|
||||
rm -rf "$nextcloud_backup_dir"/*
|
||||
echo "Alle Dateien wurden gelöscht."
|
||||
else
|
||||
echo "Abgebrochen. Keine Dateien gelöscht."
|
||||
fi
|
||||
|
||||
|
||||
echo "Verwaiste Dateien in $nexcloud_program_dir löschen"
|
||||
echo "-----------------------------------"
|
||||
read -r -p "Alle verwaisten Dateien löschen (occ files:cleanup)? (j/N): " bestaetigung
|
||||
if [[ "$bestaetigung" =~ ^[jJ]$ ]]; then
|
||||
cd "$nexcloud_program_dir" || exit
|
||||
php occ files:cleanup
|
||||
echo "Verwaiste Dateien wurden gelöscht."
|
||||
else
|
||||
echo "Abgebrochen. Keine verwaisten Dateien gelöscht."
|
||||
fi
|
||||
@@ -1,43 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Dieses Skript aktualisiert die Nextcloud-Datenbank
|
||||
# Script Version 1.0
|
||||
|
||||
nexcloud_program_dir="/var/www/virtual/boogie/cloud.boogiedev.net"
|
||||
|
||||
if [ ! -d "$nexcloud_program_dir" ]; then
|
||||
echo "Verzeichnis nicht gefunden: $nexcloud_program_dir"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$nexcloud_program_dir" || exit
|
||||
|
||||
echo "Nextcloud Datei-Scan"
|
||||
echo "-----------------------------------"
|
||||
echo "1) Alle Benutzer scannen"
|
||||
echo "2) Einen bestimmten Benutzer scannen"
|
||||
echo "-----------------------------------"
|
||||
|
||||
read -r -p "Auswahl (1/2): " auswahl
|
||||
|
||||
case "$auswahl" in
|
||||
1)
|
||||
echo "Scanne alle Benutzer..."
|
||||
php occ files:scan --all
|
||||
echo "Scan abgeschlossen."
|
||||
;;
|
||||
2)
|
||||
read -r -p "Benutzername eingeben: " username
|
||||
if [ -z "$username" ]; then
|
||||
echo "Kein Benutzername eingegeben. Abgebrochen."
|
||||
exit 1
|
||||
fi
|
||||
echo "Scanne Dateien für Benutzer: $username"
|
||||
php occ files:scan "$username"
|
||||
echo "Scan für $username abgeschlossen."
|
||||
;;
|
||||
*)
|
||||
echo "Ungültige Auswahl. Abgebrochen."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
|
||||
# this one makes a copy of the whole /var/www/html from boogie to BFDS
|
||||
|
||||
SCRIPTPATH=$(dirname `realpath $0`)
|
||||
cd $SCRIPTPATH
|
||||
|
||||
# rsync source -> destination
|
||||
SOURCE_PATH=/var/www/virtual/boogie/html
|
||||
DEST_PATH_FILES=/mnt/bfds/rob/backup/server/boogiedev.net/var_www
|
||||
|
||||
# path of the database backups
|
||||
DEST_PATH_DB=/mnt/bfds/rob/backup/server/boogiedev.net/db
|
||||
|
||||
# EXCLUDE="--exclude-from exclude-list"
|
||||
|
||||
# ### Get all databases
|
||||
|
||||
# kick off DB dumping
|
||||
curl --insecure --silent https://backup.boogiedev.net/dump_all_databases.php
|
||||
|
||||
# download DB dumps
|
||||
cd $DEST_PATH_DB
|
||||
curl --insecure --silent https://backup.boogiedev.net/dumps.zip > dumps.zip
|
||||
if [ -f dumps.zip ]
|
||||
then
|
||||
today=`date +%F`
|
||||
mv dumps.zip all_databases_dump_$today.zip
|
||||
else
|
||||
echo "Datenbank Dump konnte nicht herunter geladen werden"
|
||||
fi
|
||||
|
||||
## aufräumen
|
||||
curl --insecure --silent https://backup.boogiedev.net/dump_all_databases.php?cleanup_dump=1
|
||||
@@ -0,0 +1,7 @@
|
||||
backup_all_databases_cMxNrCTVLBPrNo6qaonojeejCvCepekwssh
|
||||
nextcloud/config/config.php
|
||||
nextcloud/data/root/files/Extern
|
||||
nextcloud/updater
|
||||
nextcloud/backup
|
||||
/nextcloud-data/updater-*/
|
||||
files_trashbin/
|
||||
@@ -0,0 +1 @@
|
||||
credentials.php
|
||||
@@ -0,0 +1,6 @@
|
||||
The content of this folder hast to be on the Boogie server at:
|
||||
/var/www/virtual/boogie/html/backup-boogie
|
||||
|
||||
Its the server side enpoint of the backup script running on BFDS.
|
||||
|
||||
The credentials.php has to be filled but never commited to the git
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
|
||||
$zipfile = "dumps.zip";
|
||||
|
||||
if (isset($_GET['cleanup_dump']) && $_GET['cleanup_dump'] == 1)
|
||||
{
|
||||
Cleanup();
|
||||
die("Cleanup done");
|
||||
}
|
||||
|
||||
|
||||
$dumps_path = 'dumps/';
|
||||
if(file_exists($dumps_path))
|
||||
{
|
||||
array_map( 'unlink', array_filter((array) glob($dumps_path.'*') ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
mkdir('dumps');
|
||||
}
|
||||
|
||||
//read php file with credentials and parse it
|
||||
fopen("credentials.php", "r") or die("Unable to open file!");
|
||||
include 'credentials.php';
|
||||
//should priovide the following variables:
|
||||
// $db_host = 'host';
|
||||
// $db_user = 'user';
|
||||
// $db_pass = 'pw';
|
||||
|
||||
if ($db_host == NULL || $db_user == NULL || $db_pass == NULL) {
|
||||
die("Please provide credentials in credentials.php");
|
||||
}
|
||||
|
||||
$db_conn = new mysqli($db_host, $db_user, $db_pass);
|
||||
|
||||
$result = mysqli_query($db_conn,"SHOW DATABASES");
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
|
||||
if($row[0] == 'information_schema' || $row[0] == 'performance_schema')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$database = $row[0];
|
||||
$dir = dirname(__FILE__) . '/'.$dumps_path.$database.'.sql';
|
||||
|
||||
exec("mysqldump --user={$db_user} --password={$db_pass} --host={$db_host} {$database} --result-file={$dir} 2>&1", $output);
|
||||
if(!empty($output))
|
||||
{
|
||||
var_dump($output);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
## Zip all dumps
|
||||
|
||||
Cleanup($zipfile);
|
||||
$zip = new ZipArchive;
|
||||
if($zip -> open($zipfile, ZipArchive::CREATE ) === TRUE)
|
||||
{
|
||||
$dir = opendir($dumps_path);
|
||||
while($file = readdir($dir)) {
|
||||
if(is_file($dumps_path.$file)) {
|
||||
$zip -> addFile($dumps_path.$file, $file);
|
||||
}
|
||||
}
|
||||
$zip ->close();
|
||||
}
|
||||
|
||||
//eine funktion die auf den url parameter cleanup_dump=1 reagiert und dann alle dumps löscht
|
||||
function Cleanup()
|
||||
{
|
||||
global $zipfile;
|
||||
|
||||
if(file_exists($zipfile))
|
||||
{
|
||||
unlink($zipfile);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
bfds soll sich regelmässig eine copy des wikis und aller scripte auf boogedev.net (uberspace) holen
|
||||
|
||||
|
||||
Um keine hindernden Passwort-Eingaben zu haben, wird ein dezediertes keyfile ohne PW verwendet.
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Hint: to exclude any directory (for example an cache dir)
|
||||
# place the CACHEDIR.TAG file in there: https://bford.info/cachedir/
|
||||
# don't forget the signature in there and set the parameter: --exclude-caches
|
||||
|
||||
export RESTIC_REPOSITORY=bfds:/mnt/bfds/rob-restic-backups/restic-repo-t520-user
|
||||
export RESTIC_PASSWORD=kopenhagenhatsuperinternetwirklich
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
|
||||
# backup the whole user dir to bfds
|
||||
#restic -r sftp:${RESTIC_REPOSITORY} backup /home/rob --exclude-caches --exclude-file=${SCRIPT_DIR}/backup.excludes
|
||||
|
||||
# find files in backup. $1 is the parameter from comand line.
|
||||
# example: $ backup-list-files.sh /home/rob/Pictures > output.txt
|
||||
# find all files containing Pictures path and out into output.txt
|
||||
restic -r sftp:${RESTIC_REPOSITORY} find $1
|
||||
|
||||
|
||||
#restic -r sftp:bfds:/mnt/bfds/rob-restic-backups/restic-repo-t520-user backup /home/rob --exclude-caches
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Hint: to exclude any directory (for example an cache dir)
|
||||
# place the CACHEDIR.TAG file in there: https://bford.info/cachedir/
|
||||
# don't forget the signature in there and set the parameter: --exclude-caches
|
||||
|
||||
export RESTIC_REPOSITORY=bfds:/mnt/bfds/rob-restic-backups/restic-repo-t520-user
|
||||
export RESTIC_PASSWORD=kopenhagenhatsuperinternetwirklich
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
|
||||
# backup the whole user dir to bfds
|
||||
# restic -r sftp:${RESTIC_REPOSITORY} backup /home/rob --exclude-caches --exclude-file=${SCRIPT_DIR}/backup.excludes
|
||||
|
||||
#restic stats -r sftp:${RESTIC_REPOSITORY}
|
||||
restic snapshots -r sftp:${RESTIC_REPOSITORY}
|
||||
@@ -0,0 +1,21 @@
|
||||
#Just Caches
|
||||
**/.cache/
|
||||
**/cache/
|
||||
**/Cache/
|
||||
|
||||
#Logs
|
||||
**/log/
|
||||
**/logs/
|
||||
**/Log/
|
||||
**/Logs/
|
||||
*.log
|
||||
|
||||
# VSCode
|
||||
/home/rob/.config/Code/Cache
|
||||
/home/rob/.config/Code/CachedData
|
||||
/home/rob/.config/Code/CachedExtensions
|
||||
/home/rob/.config/Code/CachedExtensionVSIXs
|
||||
|
||||
# Firefox und Co.
|
||||
/home/rob/.mozilla
|
||||
/home/rob/Downloads
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Hint: to exclude any directory (for example an cache dir)
|
||||
# place the CACHEDIR.TAG file in there: https://bford.info/cachedir/
|
||||
# don't forget the signature in there and set the parameter: --exclude-caches
|
||||
|
||||
export RESTIC_REPOSITORY=bfds:/mnt/bfds/rob-restic-backups/restic-repo-t520-user
|
||||
export RESTIC_PASSWORD=kopenhagenhatsuperinternetwirklich
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
|
||||
# backup the whole user dir to bfds
|
||||
restic -r sftp:${RESTIC_REPOSITORY} backup /home/rob --exclude-caches --exclude-file=${SCRIPT_DIR}/backup.excludes
|
||||
|
||||
|
||||
#restic -r sftp:bfds:/mnt/bfds/rob-restic-backups/restic-repo-t520-user backup /home/rob --exclude-caches
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
# mount the backup into the file system
|
||||
|
||||
MOUNTPOINT="/mnt/restic-backup-me"
|
||||
|
||||
echo Erstelle Ordner $MOUNTPOINT via sudo
|
||||
sudo mkdir $MOUNTPOINT
|
||||
sudo chown rob:rob $MOUNTPOINT
|
||||
|
||||
echo Mount Backup
|
||||
./restic-bfds.sh mount $MOUNTPOINT
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Hint: to exclude any directory (for example an cache dir)
|
||||
# place the CACHEDIR.TAG file in there: https://bford.info/cachedir/
|
||||
# don't forget the signature in there and set the parameter: --exclude-caches
|
||||
|
||||
export RESTIC_REPOSITORY=bfds:/mnt/bfds/rob-restic-backups/restic-repo-t520-user
|
||||
export RESTIC_PASSWORD=kopenhagenhatsuperinternetwirklich
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
|
||||
# restic wrapper for use with command line arguments
|
||||
restic -r sftp:${RESTIC_REPOSITORY} $1 $2 $3 $4 $5 $6 $7 $8 $9
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
INCLUDE_FILES="/home/rob/Pictures/2022/*"
|
||||
RESTORE_PATH="/home/rob/Pictures/from_restic/"
|
||||
./restic-bfds.sh restore --target "$RESTORE_PATH" --include "$INCLUDE_FILES" latest
|
||||
@@ -0,0 +1,7 @@
|
||||
backup_all_databases_cMxNrCTVLBPrNo6qaonojeejCvCepekwssh
|
||||
nextcloud/config/config.php
|
||||
nextcloud/data/root/files/Extern
|
||||
nextcloud/updater
|
||||
nextcloud/backup
|
||||
/nextcloud-data/updater-*/
|
||||
files_trashbin/
|
||||
@@ -0,0 +1,3 @@
|
||||
This folder hast to be on the SBZ server
|
||||
|
||||
The credentials.php has to be filled but never commited to the git
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
$dumps_path = 'dumps/';
|
||||
if(file_exists($dumps_path))
|
||||
{
|
||||
array_map( 'unlink', array_filter((array) glob($dumps_path.'*') ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
mkdir('dumps');
|
||||
}
|
||||
|
||||
$host = 'localhost';
|
||||
$user = 'root';
|
||||
$pass = "AdfQ3prfUDPu2MtaoLFtxvWbdBooJ6";
|
||||
|
||||
$db_conn = new mysqli($host, $user, $pass);
|
||||
|
||||
$result = mysqli_query($db_conn,"SHOW DATABASES");
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
|
||||
if($row[0] == 'information_schema' || $row[0] == 'performance_schema')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$database = $row[0];
|
||||
$dir = dirname(__FILE__) . '/'.$dumps_path.$database.'.sql';
|
||||
|
||||
exec("mysqldump --user={$user} --password={$pass} --host={$host} {$database} --result-file={$dir} 2>&1", $output);
|
||||
if(!empty($output))
|
||||
{
|
||||
var_dump($output);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
## Zip all dumps
|
||||
$zipfile = "dumps.zip";
|
||||
|
||||
if(file_exists($zipfile))
|
||||
{
|
||||
unlink($zipfile);
|
||||
}
|
||||
$zip = new ZipArchive;
|
||||
if($zip -> open($zipfile, ZipArchive::CREATE ) === TRUE)
|
||||
{
|
||||
$dir = opendir($dumps_path);
|
||||
while($file = readdir($dir)) {
|
||||
if(is_file($dumps_path.$file)) {
|
||||
$zip -> addFile($dumps_path.$file, $file);
|
||||
}
|
||||
}
|
||||
$zip ->close();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
bfds soll sich regelmässig eine copy der nextcloud instanz ziehen
|
||||
|
||||
Dazu wird der home-rob container im /home/rob gemountet und dann auf file basis eine Kopie vom kompletten /var/www/html
|
||||
|
||||
Nextcloud wird zu dem dazu in den maintenance mode versetzt.
|
||||
|
||||
Um keoine Passwort-Eingaben zu verhindern, wird ein dezediertes keyfile ohne PW verwendet.
|
||||
Executable
+69
@@ -0,0 +1,69 @@
|
||||
#!/bin/sh
|
||||
|
||||
# this one makes a copy of the whole /var/www/html from sbz
|
||||
#
|
||||
# to recover nextcloud data see: https://docs.nextcloud.com/server/13/admin_manual/maintenance/restore.html
|
||||
#
|
||||
# rsync args:
|
||||
# -a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
|
||||
# -r, --recursive recurse into directories
|
||||
# -l, --links When symlinks are encountered, recreate the symlink on the destination.
|
||||
# -h, --human-readable Output numbers in a more human-readable format.
|
||||
|
||||
SCRIPTPATH=$(dirname `realpath $0`)
|
||||
cd $SCRIPTPATH
|
||||
|
||||
# rsync source -> destination
|
||||
SOURCE_PATH=/var/www/
|
||||
DEST_PATH_FILES=/mnt/bfds/rob/backup/server/spaceboyz.net/var_www
|
||||
|
||||
# ssh credentials
|
||||
PORT="42523"
|
||||
KEY="${SCRIPTPATH}/sbz_keyless"
|
||||
USER_AT_HOST="rob@spaceboyz.net"
|
||||
|
||||
# path of the database backups
|
||||
DEST_PATH_DB=/mnt/bfds/rob/backup/server/spaceboyz.net/mariadb
|
||||
|
||||
## path where home-rob container is mouted into host (on SBZ)
|
||||
SBZ_MOUNT_PATH=/home/rob/tmp_mnt
|
||||
|
||||
## path of the nextcloud instance (on SBZ)
|
||||
NEXTCLOUD_PATH=/var/www/html/nextcloud
|
||||
|
||||
EXCLUDE="--exclude-from exclude-list"
|
||||
|
||||
|
||||
# mount my lxc container into my home on sbz
|
||||
ssh -p $PORT -i $KEY $USER_AT_HOST "sudo mount /dev/mapper/vms-home--rob $SBZ_MOUNT_PATH"
|
||||
|
||||
# grand read permissons if not given
|
||||
ssh -p $PORT -i $KEY $USER_AT_HOST "sudo chmod -R +rx ${SBZ_MOUNT_PATH}/var/www/nextcloud-data"
|
||||
|
||||
# put nextcloud into maintenance, outside the home-rob container
|
||||
ssh -p $PORT -i $KEY $USER_AT_HOST "sudo sed -i \"s|'maintenance' => false|'maintenance' => true|g\" $SBZ_MOUNT_PATH$NEXTCLOUD_PATH/config/config.php"
|
||||
|
||||
# rsync download from sbz
|
||||
rsync --quiet -a -zz --progress $EXCLUDE -e "ssh -p $PORT -i $KEY" $USER_AT_HOST:${SBZ_MOUNT_PATH}${SOURCE_PATH} ${DEST_PATH_FILES}
|
||||
|
||||
# turn off nextcloud maintenancThis rsync lacks old-style --compress due to its external zlibe, outside the home-rob container
|
||||
ssh -p $PORT -i $KEY $USER_AT_HOST "sudo sed -i \"s|'maintenance' => true|'maintenance' => false|g\" $SBZ_MOUNT_PATH$NEXTCLOUD_PATH/config/config.php"
|
||||
|
||||
# umount my container
|
||||
ssh -p $PORT -i $KEY $USER_AT_HOST "sudo umount $SBZ_MOUNT_PATH"
|
||||
|
||||
|
||||
### Get all databases
|
||||
|
||||
cd $DEST_PATH_DB
|
||||
# kick off DB dumping
|
||||
curl --insecure --silent https://rob.spaceboyz.net/backup_all_databases_cMxNrCTVLBPrNo6qaonojeejCvCepekwssh/dump_all_databases.php
|
||||
# download DB dumps
|
||||
curl --insecure --silent https://rob.spaceboyz.net/backup_all_databases_cMxNrCTVLBPrNo6qaonojeejCvCepekwssh/dumps.zip > dumps.zip
|
||||
if [ -f dumps.zip ]
|
||||
then
|
||||
today=`date +%F`
|
||||
mv dumps.zip all_databases_dump_$today.zip
|
||||
else
|
||||
echo "Datenbank Dump konnte nicht herunter geladen werden"
|
||||
fi
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||
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
|
||||
-----END OPENSSH PRIVATE KEY-----
|
||||
@@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCrW6mg83W/cdQuaB/G0kjV3rTRUv76sXvTlyyauli6SjEsemfeDoVTDAsPUXu6ql+aKeAIE70dbq8uYdmu0hwZvUHNVcwLKIV9vTvoeMBAfNX81aTw+koXfZ6SR6MW8vaNK+b4eUYvTa4bS7FwrUXMgQV3mlnUpPLGgS+0K47id1hyxwOolzbLtGTdR1ucVzE+ZitHt3Vn6/AJ1KJV2+TFSZZXKhUp7lidHwrQt2x0n/zkQ/BW8+sL5b7/2G4kUL++OfF+nZjQGFZgnVIU28fmK1izkYtni2PYPzResy8r3eAwrqv5/8w7FqI3Lx2BkBHxKZU3sEOwV4Y5BBZACv4zk39VTJDaz55Asf7g+cCOFY0zqr/sYWek0zlPP2ccs9gi5gH/oLeLLCBPGCgefH6az8qfwvDu+gN0ugUo4aH4HfWEzZpS5klx3F12txxV514Z1RKSxvImuCg03SYvMX1cluusbO2uRj9VJ0VnA9g+UiEm/UJf9GgB450fXEcjJUyUyQ8eFyD7TPIKBzCxv0GDclKKzJeeUbfGkxQockpl3he1cIISfyoxPETyzTwIz/LOQsScMpC4W9r1yc0MJcNy8e0K6h/Bwev6tEqV0qIHzv5bnjVdDkKbEMMJ7LaBeUQstgJ4w3tgVxN6QgvTesDCRg4oWuqb5d82eAvl/9k+dQ== rob@d3v.localdomain
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>com.backup-recordings-to-bfds</string>
|
||||
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/bin/bash</string>
|
||||
<string>/Users/rob/code/lokale-scripte/macos/Backup-Recordings/backup-recordings-to-bfds.sh</string>
|
||||
</array>
|
||||
|
||||
<key>StartCalendarInterval</key>
|
||||
<dict>
|
||||
<key>Hour</key>
|
||||
<integer>12</integer>
|
||||
<key>Minute</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
|
||||
<key>StandardOutPath</key>
|
||||
<string>/Users/rob/code/lokale-scripte/macos/Backup-Recordings/run-backup-recordings_output.log</string>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>/Users/rob/code/lokale-scripte/macos/Backup-Recordings/run-backup-recordings_error.log</string>
|
||||
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Quelle und Ziel definieren
|
||||
SOURCE="/Users/rob/Recordings/Work/"
|
||||
TARGET="/Volumes/rob/recordings/Progress/Work/"
|
||||
MOUNT_POINT="/Volumes/rob"
|
||||
SERVER_ADDRESS="smb://bfds/rob"
|
||||
|
||||
# Prüfen, ob das Netzlaufwerk gemountet ist
|
||||
if mount | grep -q "$MOUNT_POINT"; then
|
||||
echo "Netzlaufwerk ist gemountet. Backup startet..."
|
||||
else
|
||||
echo "Netzlaufwerk nicht gefunden. Versuche zu mounten..."
|
||||
osascript -e "mount volume \"$SERVER_ADDRESS\""
|
||||
|
||||
# Nach dem Mounten erneut prüfen
|
||||
if mount | grep -q "$MOUNT_POINT"; then
|
||||
echo "Netzlaufwerk erfolgreich gemountet."
|
||||
else
|
||||
echo "Fehler: Netzlaufwerk konnte nicht gemountet werden."
|
||||
osascript -e 'display notification "Backup fehlgeschlagen! Netzlaufwerk nicht erreichbar." with title "Backup Script"'
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Sicherung starten
|
||||
rsync -v -r -l -t -D "$SOURCE" "$TARGET"
|
||||
|
||||
# -r → Rekursiv kopieren (alle Unterordner & Dateien)
|
||||
# -l → Symbolische Links kopieren
|
||||
# -t → Zeitstempel beibehalten
|
||||
# -D → Geräte- und Sonderdateien kopiere
|
||||
|
||||
# Erfolgsmeldung ausgeben
|
||||
echo "Backup abgeschlossen: $DATE"
|
||||
|
||||
# Optional: Notification für macOS anzeigen
|
||||
osascript -e 'display notification "Backup abgeschlossen!" with title "Backup Script"'
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
Transfer starting: 2080 files
|
||||
./00_MacOS/ErsterGitarrenTest/.DS_Store
|
||||
./00_MacOS/Mobile Beats/.DS_Store
|
||||
./00_MacOS/ReaperOnLinuxErsterTestt/.DS_Store
|
||||
./00_MacOS/Vielleicht mal ein RMB Song/.DS_Store
|
||||
rsync: mkstemp "/Volumes/rob/recordings/Progress/Work/00_MacOS/ErsterGitarrenTest/..DS_Store.bvPX7I" failed: Operation not permitted (1)
|
||||
rsync: mkstemp "/Volumes/rob/recordings/Progress/Work/00_MacOS/Mobile Beats/..DS_Store.3IHOo3" failed: Operation not permitted (1)
|
||||
rsync: failed to set times on "/Volumes/rob/recordings/Progress/Work/02_Windows/After Work - NY Video": Operation not permitted (1)
|
||||
./00_MacOS/dance the break/.DS_Store
|
||||
./01_Linux/DumDrumsV1/.DS_Store
|
||||
./01_Linux/Maschienenraum/.DS_Store
|
||||
./01_Linux/VN9J6C~K/.DS_Store
|
||||
./01_Linux/YoutubeNachbauen/.DS_Store
|
||||
rsync: mkstemp "/Volumes/rob/recordings/Progress/Work/00_MacOS/ReaperOnLinuxErsterTestt/..DS_Store.HZfDuM" failed: Operation not permitted (1)
|
||||
./02_Windows/LMMS/.DS_Store
|
||||
./02_Windows/MCSequencer-FirstTest/.DS_Store
|
||||
rsync: mkstemp "/Volumes/rob/recordings/Progress/Work/00_MacOS/Vielleicht mal ein RMB Song/..DS_Store.ROkSo0" failed: Operation not permitted (1)
|
||||
rsync: mkstemp "/Volumes/rob/recordings/Progress/Work/00_MacOS/dance the break/..DS_Store.aFBtuQ" failed: Operation not permitted (1)
|
||||
rsync: failed to set times on "/Volumes/rob/recordings/Progress/Work/02_Windows/WakeMeUp": Operation not permitted (1)
|
||||
rsync: mkstemp "/Volumes/rob/recordings/Progress/Work/01_Linux/DumDrumsV1/..DS_Store.yWjLTm" failed: Operation not permitted (1)
|
||||
./03_LMMS/plugins/.DS_Store
|
||||
./05_Midi/Groove Monkee Free MIDI GM/.DS_Store
|
||||
rsync: mkstemp "/Volumes/rob/recordings/Progress/Work/01_Linux/Maschienenraum/..DS_Store.lnwOWK" failed: Operation not permitted (1)
|
||||
rsync: mkstemp "/Volumes/rob/recordings/Progress/Work/01_Linux/VN9J6C~K/..DS_Store.q9CbtG" failed: Operation not permitted (1)
|
||||
rsync: mkstemp "/Volumes/rob/recordings/Progress/Work/01_Linux/YoutubeNachbauen/..DS_Store.JnjLUb" failed: Operation not permitted (1)
|
||||
rsync: mkstemp "/Volumes/rob/recordings/Progress/Work/02_Windows/LMMS/..DS_Store.iWwhBB" failed: Operation not permitted (1)
|
||||
rsync: mkstemp "/Volumes/rob/recordings/Progress/Work/02_Windows/MCSequencer-FirstTest/..DS_Store.kuF708" failed: Operation not permitted (1)
|
||||
rsync: mkstemp "/Volumes/rob/recordings/Progress/Work/03_LMMS/plugins/..DS_Store.GF6pRJ" failed: Operation not permitted (1)
|
||||
rsync: mkstemp "/Volumes/rob/recordings/Progress/Work/05_Midi/Groove Monkee Free MIDI GM/..DS_Store.UerlTC" failed: Operation not permitted (1)
|
||||
|
||||
sent 258314 bytes received 318 bytes 7085 bytes/sec
|
||||
total size is 646892330 speedup is 2501.21
|
||||
rsync: failed to set times on "/Volumes/rob/recordings/Progress/Work/02_Windows/After Work - NY Video": Operation not permitted (1)
|
||||
rsync: failed to set times on "/Volumes/rob/recordings/Progress/Work/02_Windows/WakeMeUp": Operation not permitted (1)
|
||||
@@ -0,0 +1,2 @@
|
||||
Netzlaufwerk ist gemountet. Backup startet...
|
||||
Backup abgeschlossen:
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
Die *.plist datei definiert wann immer das script startet (12Uhr täglich)
|
||||
Die *.plist datei definiert wann immer das cript startet (12Uhr täglich)
|
||||
|
||||
Die Befehle um das script in LaunchAgents einzufügen:
|
||||
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
@ECHO OFF
|
||||
CHCP 65001 >NUL
|
||||
REM **************************************************
|
||||
REM Dieser command sichert die Inhalt von bfds in windows
|
||||
REM auf der OFFSITE platte (Veracrypt Partition) mittels
|
||||
REM SMB Freigaben von bfds und xcopy.
|
||||
REM **************************************************
|
||||
SETLOCAL
|
||||
|
||||
|
||||
REM **************************************************
|
||||
REM Einbinden der Veracrypt Partition
|
||||
REM **************************************************
|
||||
echo Festplatte NASOFFSITE1 wird entschlüsselt und eingebunden
|
||||
SET VOLUME_LABEL=NASOFFSITE1
|
||||
SET VERACRYPT_PATH="C:\Program Files\VeraCrypt\VeraCrypt.exe"
|
||||
SET VOLUME_MOUNT_PATH="B:\"
|
||||
SET VOLUME_PASSWORD=123456
|
||||
REM get the Password for the volume from the user
|
||||
SET /P VOLUME_PASSWORD=Bitte geben Sie das Passwort für die Festplatte %VOLUME_LABEL% ein:
|
||||
%VERACRYPT_PATH% /q /v "\Device\Harddisk2\Partition1" /l B /p "%VOLUME_PASSWORD%"
|
||||
|
||||
SET SOURCE=\\bfds
|
||||
SET DESTINATION="B:\\"
|
||||
|
||||
echo Festplatte NASOFFSITE1 wird gesucht
|
||||
IF NOT EXIST %DESTINATION% (
|
||||
echo Festplatte NASOFFSITE1 nicht gefunden, bitte in Veracrypt als Laufwerk B:\ einbinden!
|
||||
PAUSE
|
||||
exit /B
|
||||
)
|
||||
|
||||
CALL :RunRobocopy "ebooks"
|
||||
CALL :RunRobocopy "movies"
|
||||
CALL :RunRobocopy "music"
|
||||
CALL :RunRobocopy "peggy"
|
||||
CALL :RunRobocopy "rob"
|
||||
exit /B %ERRORLEVEL%
|
||||
|
||||
REM **************************************************
|
||||
REM Funktion zum Ausführen von robocopy
|
||||
:RunRobocopy
|
||||
SET COPYPATH=%~1
|
||||
IF NOT EXIST %SOURCE%\%COPYPATH% (
|
||||
echo Quelle nicht gefunden! Bitte öffne die SMB Freigbe: %SOURCE%\%COPYPATH%
|
||||
PAUSE
|
||||
exit /B %ERRORLEVEL%
|
||||
)
|
||||
SET SCRIPT_PATH=%~dp0
|
||||
SET TODAY=%DATE:~6,4%%DATE:~3,2%%DATE:~0,2%
|
||||
SET LOGFILE="%SCRIPT_PATH%robocopy_log_%COPYPATH%_%TODAY%.txt"
|
||||
echo LOGFILE: %LOGFILE%
|
||||
robocopy %SOURCE%\%COPYPATH% %DESTINATION%\%COPYPATH% /E /mt /z /J /COPY:DAT /R:3 /W:5 /LOG+:%LOGFILE% /TEE
|
||||
REM Erklärung der Parameter:
|
||||
REM /E: Kopiert Unterverzeichnisse inklusive leerer Verzeichnisse
|
||||
REM /mt: Multithreaded copying
|
||||
REM /z: Kopiert Dateien im Restart-Modus (d.h. kopiert Dateien, die bereits existieren)
|
||||
REM /COPY:DAT: Kopiert Dateiattribute, Zeitstempel und Sicherheitsinformationen
|
||||
REM /R:3: Anzahl der Wiederholungsversuche bei Fehlern
|
||||
REM /W:5: Wartezeit zwischen den Wiederholungsversuchen
|
||||
REM /J: Kopiert mit unbuffered I/O (empfohlen für große Dateien)
|
||||
REM /LOG+: Protokolliert den Kopiervorgang in eine Datei
|
||||
REM /TEE: Protokolliert den Kopiervorgang auch in der Konsole
|
||||
GOTO :EOF
|
||||
REM **************************************************
|
||||
|
||||
REM **************************************************
|
||||
REM Partiton wieder aushängen
|
||||
REM **************************************************
|
||||
%VERACRYPT_PATH% /d B /q
|
||||
@@ -0,0 +1,8 @@
|
||||
bfds soll ein funktionierendes off-site backup bekommen
|
||||
|
||||
Dazu sollte am besten eine USB-HDD direkt an bfds gehangen werdn das automatisch überspielt wird.
|
||||
|
||||
Oder die Platte kommt an den Lappi und ein rsync zieht sich alle Änderungen von bfds:/mnt/bfds nach /run/media/rob/BFDS-OFFSITE-1/
|
||||
|
||||
Label HDD1: BFDS-OFFSITE-1
|
||||
Label HDD2: BFDS-OFFSITE-2
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
# FIRST Encrypt!
|
||||
## von Hand und mit Dolphin
|
||||
|
||||
# only run when BFDS-OFFSITE-1 or BFDS-OFFSITE-2 is attached
|
||||
# find correct drive `ls -l /dev/disk/by-label/BFDS-OFFSITE-1` or `lsblk -o name,mountpoint,label,size,uuid /dev/sdb1 | grep BFDS-OFFSITE-`
|
||||
# BFDS-OFFSITE-1 UUID: 45f76efd-1cb0-4ade-b610-0443eb8079e9
|
||||
|
||||
# find correct drive `ls -l /dev/disk/by-label/BFDS-OFFSITE-1` or `lsblk -o name,mountpoint,label,size,uuid /dev/sdb1 | grep BFDS-OFFSITE-`
|
||||
|
||||
echo "#####################################################"
|
||||
echo "## ##"
|
||||
echo "## BFDS-OFFSITE BACKUP ##"
|
||||
echo "## ##"
|
||||
echo "#####################################################"
|
||||
echo "## FIRST Encrypt HDD! von Hand und mit Dolphin ##"
|
||||
echo "#####################################################"
|
||||
|
||||
string=`ls -l /dev/disk/by-label/BFDS-OFFSITE-*`
|
||||
if [[ $string != *"BFDS-OFFSITE-"* ]]; then
|
||||
echo "\n ABBRUCH! Keine angeschlossene OFFSITE Festplatte gefunden."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# run backup
|
||||
sourceDir="bfds:/mnt/bfds/" # on BFDS
|
||||
destinationDir="/run/media/rob/BFDS-OFFSITE-1/BFDS"
|
||||
rsync -a -zz --stats --progress $sourceDir $destinationDir
|
||||
|
||||
|
||||
read -p "Backupprozess beendet. Taste drücken für weiter.."
|
||||
Reference in new issue
Block a user