diff --git a/src/include/ABHelper.php b/src/include/ABHelper.php index 434a40b..8066487 100644 --- a/src/include/ABHelper.php +++ b/src/include/ABHelper.php @@ -165,14 +165,17 @@ public static function stopContainer($container) { global $dockerClient, $abSettings; $containerSettings = $abSettings->getContainerSpecificSettings($container['Name']); - if ($containerSettings['dontStop'] == 'yes') { - self::backupLog("NOT stopping " . $container['Name'] . " because it should be backed up WITHOUT stopping!", self::LOGLEVEL_WARN); - self::$skipStartContainers[] = $container['Name']; - return true; - } + if ($container['Running'] && !$container['Paused']) { self::backupLog("Stopping " . $container['Name'] . "... ", self::LOGLEVEL_INFO, false); + + if ($containerSettings['dontStop'] == 'yes') { + self::backupLog("NOT stopping " . $container['Name'] . " because it should be backed up WITHOUT stopping!", self::LOGLEVEL_WARN); + self::$skipStartContainers[] = $container['Name']; + return true; + } + $stopTimer = time(); $dockerStopCode = $dockerClient->stopContainer($container['Name']); if ($dockerStopCode != 1) { @@ -513,7 +516,7 @@ public static function getContainerVolumes($container) { continue; } if (in_array($hostPath, $abSettings->allowedSources)) { - self::backupLog("Removing container mapping \"$hostPath\" because it is a source path!"); + self::backupLog("Removing container mapping \"$hostPath\" because it is a source path (exact match)!"); continue; } $volumes[] = $hostPath; diff --git a/src/scripts/backup.php b/src/scripts/backup.php index d914b5a..e0d7be2 100644 --- a/src/scripts/backup.php +++ b/src/scripts/backup.php @@ -347,8 +347,6 @@ ABHelper::backupLog("Backup cancelled! Executing final things. You will be left behind with the current state!", ABHelper::LOGLEVEL_WARN); } -ABHelper::handlePrePostScript($abSettings->postRunScript, 'post-run', $abDestination, ($errorOccured ? 'false' : 'true')); - ABHelper::backupLog("DONE! Thanks for using this plugin and have a safe day ;)"); ABHelper::backupLog("❤️"); @@ -374,4 +372,6 @@ } unlink(ABSettings::$tempFolder . '/' . ABSettings::$stateFileScriptRunning); -ABHelper::handlePrePostScript($abSettings->postRunScript, 'post-run', $abDestination, (ABHelper::$errorOccured ? 'false' : 'true')); \ No newline at end of file +ABHelper::handlePrePostScript($abSettings->postRunScript, 'post-run', $abDestination, (ABHelper::$errorOccured ? 'false' : 'true')); + +exit(ABHelper::$errorOccured ? 1 : 0); \ No newline at end of file