migrate all backups scripts into new Repo called "Brücke"

This commit is contained in:
trnq1ll0 committed 2026-11-02 01:21:35 +01:00
1 parent 46e13a4dd5
commit 44674bdc38
32 files changed
-1515

No files matched your search

-34
View File
@@ -1,34 +0,0 @@
#!/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
-7
View File
@@ -1,7 +0,0 @@
backup_all_databases_cMxNrCTVLBPrNo6qaonojeejCvCepekwssh
nextcloud/config/config.php
nextcloud/data/root/files/Extern
nextcloud/updater
nextcloud/backup
/nextcloud-data/updater-*/
files_trashbin/
@@ -1 +0,0 @@
credentials.php
@@ -1,6 +0,0 @@
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
@@ -1,83 +0,0 @@
<?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);
}
}
-4
View File
@@ -1,4 +0,0 @@
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.
-21
View File
@@ -1,21 +0,0 @@
#!/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
-16
View File
@@ -1,16 +0,0 @@
#!/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}
-21
View File
@@ -1,21 +0,0 @@
#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
-16
View File
@@ -1,16 +0,0 @@
#!/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
-12
View File
@@ -1,12 +0,0 @@
#!/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
-13
View File
@@ -1,13 +0,0 @@
#!/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
-5
View File
@@ -1,5 +0,0 @@
#!/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
-7
View File
@@ -1,7 +0,0 @@
backup_all_databases_cMxNrCTVLBPrNo6qaonojeejCvCepekwssh
nextcloud/config/config.php
nextcloud/data/root/files/Extern
nextcloud/updater
nextcloud/backup
/nextcloud-data/updater-*/
files_trashbin/
-3
View File
@@ -1,3 +0,0 @@
This folder hast to be on the SBZ server
The credentials.php has to be filled but never commited to the git
@@ -1,58 +0,0 @@
<?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();
}
-7
View File
@@ -1,7 +0,0 @@
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.
-69
View File
@@ -1,69 +0,0 @@
#!/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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