From 17494e3afbda6b68beb3c49d1ace713e5019ed9b Mon Sep 17 00:00:00 2001 From: Robert Wartenberg Date: Wed, 4 Oct 2023 08:03:44 +0200 Subject: [PATCH] add first draft boogie backup scripts --- backup-boogie/backup-boogie.sh | 37 +++++++++++ backup-boogie/exclude-list | 7 ++ backup-boogie/on_boogie_side/.gitignore | 1 + backup-boogie/on_boogie_side/README | 3 + .../on_boogie_side/dump_all_databases.php | 65 +++++++++++++++++++ backup-boogie/readme.md | 4 ++ 6 files changed, 117 insertions(+) create mode 100644 backup-boogie/backup-boogie.sh create mode 100644 backup-boogie/exclude-list create mode 100644 backup-boogie/on_boogie_side/.gitignore create mode 100644 backup-boogie/on_boogie_side/README create mode 100644 backup-boogie/on_boogie_side/dump_all_databases.php create mode 100644 backup-boogie/readme.md diff --git a/backup-boogie/backup-boogie.sh b/backup-boogie/backup-boogie.sh new file mode 100644 index 0000000..70e759c --- /dev/null +++ b/backup-boogie/backup-boogie.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +# this one makes a copy of the whole /var/www/html from boogiedev + +todo! + +SCRIPTPATH=$(dirname `realpath $0`) +cd $SCRIPTPATH + +# rsync source -> destination +SOURCE_PATH=/var/www/virtual/boogie/html +DEST_PATH_FILES=/mnt/bfds/rob/backup/server/boggiedev.net/var_www + +# # ssh credentials +PORT="22" +KEY="${SCRIPTPATH}/boogie_keyless" +USER_AT_HOST="boogie@spaceboyz.net" + +# path of the database backups +DEST_PATH_DB=/mnt/bfds/rob/backup/server/spaceboyz.net/mariadb + +# EXCLUDE="--exclude-from exclude-list" + +# ### 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 diff --git a/backup-boogie/exclude-list b/backup-boogie/exclude-list new file mode 100644 index 0000000..8503ae4 --- /dev/null +++ b/backup-boogie/exclude-list @@ -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/ diff --git a/backup-boogie/on_boogie_side/.gitignore b/backup-boogie/on_boogie_side/.gitignore new file mode 100644 index 0000000..784098f --- /dev/null +++ b/backup-boogie/on_boogie_side/.gitignore @@ -0,0 +1 @@ +credentials.php \ No newline at end of file diff --git a/backup-boogie/on_boogie_side/README b/backup-boogie/on_boogie_side/README new file mode 100644 index 0000000..f01ff88 --- /dev/null +++ b/backup-boogie/on_boogie_side/README @@ -0,0 +1,3 @@ +This folder hast to be on the Boogie server + +The credentials.php has to be filled but never commited to the git \ No newline at end of file diff --git a/backup-boogie/on_boogie_side/dump_all_databases.php b/backup-boogie/on_boogie_side/dump_all_databases.php new file mode 100644 index 0000000..3c0d630 --- /dev/null +++ b/backup-boogie/on_boogie_side/dump_all_databases.php @@ -0,0 +1,65 @@ +&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(); +} diff --git a/backup-boogie/readme.md b/backup-boogie/readme.md new file mode 100644 index 0000000..940e56a --- /dev/null +++ b/backup-boogie/readme.md @@ -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.