New cron and logrotate jobs for DockerStorage backup

This commit is contained in:
Chris Toph 2024-09-16 17:24:28 -04:00
parent 1f59c3c6f7
commit 44df454f96
6 changed files with 33 additions and 11 deletions

View file

@ -23,6 +23,10 @@ in {
# ACME
./modules/acme
# cron
./modules/cron
# Logrotate
./modules/logrotate
# Nextcloud
./modules/nextcloud
# Nginx

View file

@ -0,0 +1,11 @@
{
services.cron = {
enable = true;
systemCronJobs = [
# Runs snapraid-runner every day at 3am
"0 3 * * * root snapraid-runner"
# Runs a backup of the Docker storage directory every Monday at 4am
"0 4 * * 0 root tar -Pzcf /pool/Backups/DockerStorage/DockerStorage.tar.gz -C /mnt/drive1/DockerStorage ."
];
};
}

View file

@ -0,0 +1,6 @@
{
services.logrotate = {
enable = true;
configFile = ./logrotate.conf;
};
}

View file

@ -0,0 +1,11 @@
dateext
missingok
notifempty
rotate 4
"/pool/Backups/DockerStorage/DockerStorage.tar.gz" {
weekly
rotate 8
nocompress
su root root
}

View file

@ -1,7 +1,6 @@
{ pkgs, ... }:
{
environment.etc."snapraid.conf".text = builtins.readFile ./snapraid.conf;
environment.etc."snapraid-runner.conf".text = ''
[snapraid]
@ -35,12 +34,4 @@
plan = 12
older-than = 10
'';
services.cron = {
enable = true;
systemCronJobs = [
# Runs snapraid-runner every day at 3am
"0 3 * * * root snapraid-runner"
];
};
}

View file

@ -52,5 +52,4 @@ stdenv.mkDerivation rec {
mkdir -p $out/bin
ln -sf ${snapraid-runner}/bin/snapraid-runner $out/bin/snapraid-runner'';
};
}
}