mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-20 14:36:52 +00:00
add option to enable daily backups
Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
parent
936b4ebb0f
commit
bcf36406a8
19 changed files with 314 additions and 16 deletions
29
php/src/Cron/BackupNotification.php
Normal file
29
php/src/Cron/BackupNotification.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
// increase memory limit to 2GB
|
||||
ini_set('memory_limit', '2048M');
|
||||
|
||||
use DI\Container;
|
||||
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$container = \AIO\DependencyInjection::GetContainer();
|
||||
|
||||
/** @var \AIO\Docker\DockerActionManager $dockerActionManger */
|
||||
$dockerActionManger = $container->get(\AIO\Docker\DockerActionManager::class);
|
||||
/** @var \AIO\ContainerDefinitionFetcher $containerDefinitionFetcher */
|
||||
$containerDefinitionFetcher = $container->get(\AIO\ContainerDefinitionFetcher::class);
|
||||
|
||||
$id = 'nextcloud-aio-nextcloud';
|
||||
$nextcloudContainer = $containerDefinitionFetcher->GetContainerById($id);
|
||||
|
||||
$backupExitCode = $dockerActionManger->GetBackupcontainerExitCode();
|
||||
|
||||
if ($backupExitCode === 0) {
|
||||
$dockerActionManger->sendNotification($nextcloudContainer, 'Daily backup successful!', 'You can get further info by looking at the backup logs in the AIO interface.');
|
||||
}
|
||||
|
||||
if ($backupExitCode > 0) {
|
||||
$dockerActionManger->sendNotification($nextcloudContainer, 'Daily backup failed!', 'You can get further info by looking at the backup logs in the AIO interface.');
|
||||
}
|
||||
20
php/src/Cron/DailyBackup.php
Normal file
20
php/src/Cron/DailyBackup.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
// increase memory limit to 2GB
|
||||
ini_set('memory_limit', '2048M');
|
||||
|
||||
use DI\Container;
|
||||
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$container = \AIO\DependencyInjection::GetContainer();
|
||||
|
||||
/** @var \AIO\Controller\DockerController $dockerController */
|
||||
$dockerController = $container->get(\AIO\Controller\DockerController::class);
|
||||
|
||||
// Stop container and start backup
|
||||
$dockerController->startBackup();
|
||||
|
||||
// Start apache
|
||||
$dockerController->startTopContainer();
|
||||
17
php/src/Cron/UpdateMastercontainer.php
Normal file
17
php/src/Cron/UpdateMastercontainer.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
// increase memory limit to 2GB
|
||||
ini_set('memory_limit', '2048M');
|
||||
|
||||
use DI\Container;
|
||||
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$container = \AIO\DependencyInjection::GetContainer();
|
||||
|
||||
/** @var \AIO\Controller\DockerController $dockerController */
|
||||
$dockerController = $container->get(\AIO\Controller\DockerController::class);
|
||||
|
||||
# Update the mastercontainer
|
||||
$dockerController->startWatchtower();
|
||||
Loading…
Add table
Add a link
Reference in a new issue