From a28a9888984ce8ecb71a7b208d526ed1e8ab9c79 Mon Sep 17 00:00:00 2001 From: Robin Kluth Date: Wed, 21 Dec 2022 20:26:13 +0100 Subject: [PATCH] Test Release --- ca.backup2.test.plg | 172 ++++++++++++++++++ .../plugins/ca.backup2/scripts/backup.php | 12 ++ .../plugins/ca.backup2/scripts/killRsync.php | 5 +- 3 files changed, 188 insertions(+), 1 deletion(-) create mode 100644 ca.backup2.test.plg diff --git a/ca.backup2.test.plg b/ca.backup2.test.plg new file mode 100644 index 0000000..73b4561 --- /dev/null +++ b/ca.backup2.test.plg @@ -0,0 +1,172 @@ + + + + + + + + + +]> + + + + +##2022.12.21 +- Added some debug infos for the "Not stopping" docker issue +- Fixes "Abort" function + +###2022.12.08 +- Fix scanned source files with spaces in it +- Output a bit more debug info for not stopped containers. + +###2022.12.05 +- Fix `Allowed memory size of xxx exhausted` error, which was caused by a too big logfile from previous plugin version. +- Also copy the log in case of an error +- Fixed the exclusion of subfolders + +###2022.12.04 +- Fixed a permission issue, which prevented the backup to run + +###2022.12.02 +- Fixed tar verification check +- Changed schedule hour format in settings page +- Added option to disable the warning message when accessing the settings page +- Added option to create multiple archives - one for each appdata folder +- Fixed some styling inside settings page +- The logging tab now shows the whole log as well as date/time +- Fixed an error, which caused a reset of the log while backing up +- Made docker container stops/starts more robust: the plugin now tries 3 times to start a container +- The backup log is now copied to the destination to keep it with its run + +###2022.07.23 +- Set permissions on backups to be 0777 + +###2021.12.05 +- Don't exclude the docker image file since it's now extremely rare for it to be placed within appdata + +###2021.11.03 +- Fixed: File picker for start / stop scripts wasn't working + +###2021.03.13 +- Deprecate usb backup (still works though) when running Unraid 6.9 + +###2021.03.10 +- Permission Fix + +###2020.12.27 +- Fix some permission issues + +###2020.10.21 +- Compatibility Fixes + +###2020.09.27 +- When running 6.9-beta 27+, clicking on the notification will take you to the plugin's settings + +###2020.07.09 +- Execute all custom scripts from RAM + +###2020.05.31 +- Add pre-start script (Thanks jburnham) + +###2019.10.27 +- Adjust permissions on backup version of flash drive + +###2019.09.25 +- Remove purple text + +###2019.03.23 +- Utilize CA API for update checks + +###2019.03.09 +- Only rewrite the disk assignments file if it's changed + +###2019.01.13 +- update Icon + +###2018.11.17 +- unRaid 6.6+: Honor autostart rules when restarting containers + +###2018.11.11 +- Add in autov routines + +###2018.11.01 +- Fix dropdown color for 6.6 + +###2018.10.19 +- Fix Broken Pipe + +###2018.07.15 +- Fixed: Don't run a scheduled backup if array isn't started + +###2018.03.15 +- Fixed: Don't delete old backup sets if the source doesn't exist + +###2018.03.02 +- Fixed: PHP Warnings (hidden) in 6.5.0+ + +###2017.12.22 +- Fixed: Apply not being activated when using customized excluded folder + +###2017.11.26 +- Fixed: Backup schedule wouldn't run following a reboot of server + +###2017.11.23 +- Reorganization as part of updates to CA proper + +###2017.11.05 +- Initial Release + + + + + + +# Remove old 'source' files +rm -f $(ls /boot/config/plugins/&name;/&name;*.txz 2>/dev/null | grep -v '&version;') + + + + + +https://github.com/&github;/releases/download/v&version;/&name;-&version;-x86_64-1.txz +&md5; + + + + + +mkdir -p /tmp/ca.backup2/tempFiles +mkdir -p /var/lib/docker/unraid/ca.backup2.datastore +mkdir -p /boot/config/plugins/ca.backup2/ +rm -rf /usr/local/emhttp/plugins/ca.backup2/CA.page +rm -rf /usr/local/emhttp/plugins/ca.backup2/caHelp.page +/usr/local/emhttp/plugins/ca.backup2/scripts/removeCron.php +/usr/local/emhttp/plugins/ca.backup2/scripts/addCron.php +echo "" +echo "----------------------------------------------------" +echo " &name; has been installed." +echo " Copyright 2015-2020, Andrew Zawadzki" +echo " Version: &version;" +echo "----------------------------------------------------" +echo "" + + + + + + +/usr/local/emhttp/plugins/ca.backup2/scripts/removeCron.php +removepkg &name;-&version;-x86_64-1 +rm -rf &plugdir; +rm -rf /boot/config/plugins/&name; + + + diff --git a/source/ca.backup2/usr/local/emhttp/plugins/ca.backup2/scripts/backup.php b/source/ca.backup2/usr/local/emhttp/plugins/ca.backup2/scripts/backup.php index aee4b7b..2c6c3fe 100644 --- a/source/ca.backup2/usr/local/emhttp/plugins/ca.backup2/scripts/backup.php +++ b/source/ca.backup2/usr/local/emhttp/plugins/ca.backup2/scripts/backup.php @@ -147,6 +147,9 @@ function backupLog($msg, $newLine = true, $skipDate = false) } else { backupLog("Not stopping {$docker['Name']}: Not started! [{$docker['Paused']} / {$docker['Status']}]"); + backupLog("DEBUG-INFO while this happened:"); + $res = shell_exec("docker ps -a"); + backupLog($res ); } } } @@ -271,6 +274,11 @@ function backupLog($msg, $newLine = true, $skipDate = false) exec($command, $out, $returnValue); + if(!file_exists($communityPaths['backupProgress'])) { + backupLog("User aborted backup!"); + break; + } + if ($returnValue > 0) { backupLog("tar creation failed!"); $errorOccured = true; @@ -284,6 +292,10 @@ function backupLog($msg, $newLine = true, $skipDate = false) backupLog("Verifying Backup $folderName"); logger("Using command: $command"); exec($command, $out, $returnValue); + if(!file_exists($communityPaths['verifyProgress'])) { + backupLog("User aborted backup!"); + break; + } unlink($communityPaths['verifyProgress']); if ($returnValue > 0) { // Todo: Being overwritten!! backupLog("tar verify failed!"); diff --git a/source/ca.backup2/usr/local/emhttp/plugins/ca.backup2/scripts/killRsync.php b/source/ca.backup2/usr/local/emhttp/plugins/ca.backup2/scripts/killRsync.php index 9281109..5390ddc 100644 --- a/source/ca.backup2/usr/local/emhttp/plugins/ca.backup2/scripts/killRsync.php +++ b/source/ca.backup2/usr/local/emhttp/plugins/ca.backup2/scripts/killRsync.php @@ -25,6 +25,9 @@ if ( is_dir("/proc/$childPID") ) { logger("CA Backup / Restore tar process running. Killing $childPID"); posix_kill($childPID,SIGINT); -} + unlink($communityPaths['backupProgress']); + unlink($communityPaths['restoreProgress']); + unlink($communityPaths['verifyProgress']); +} ?> \ No newline at end of file