New cron and logrotate jobs for DockerStorage backup
This commit is contained in:
parent
dd8c7976e8
commit
dd3bef33b0
6 changed files with 33 additions and 11 deletions
|
@ -23,6 +23,10 @@ in {
|
|||
|
||||
# ACME
|
||||
./modules/acme
|
||||
# cron
|
||||
./modules/cron
|
||||
# Logrotate
|
||||
./modules/logrotate
|
||||
# Nextcloud
|
||||
./modules/nextcloud
|
||||
# Nginx
|
||||
|
|
11
nixos/modules/cron/default.nix
Normal file
11
nixos/modules/cron/default.nix
Normal 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 ."
|
||||
];
|
||||
};
|
||||
}
|
6
nixos/modules/logrotate/default.nix
Normal file
6
nixos/modules/logrotate/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
services.logrotate = {
|
||||
enable = true;
|
||||
configFile = ./logrotate.conf;
|
||||
};
|
||||
}
|
11
nixos/modules/logrotate/logrotate.conf
Normal file
11
nixos/modules/logrotate/logrotate.conf
Normal file
|
@ -0,0 +1,11 @@
|
|||
dateext
|
||||
missingok
|
||||
notifempty
|
||||
rotate 4
|
||||
|
||||
"/pool/Backups/DockerStorage/DockerStorage.tar.gz" {
|
||||
weekly
|
||||
rotate 8
|
||||
nocompress
|
||||
su root root
|
||||
}
|
|
@ -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"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -52,5 +52,4 @@ stdenv.mkDerivation rec {
|
|||
mkdir -p $out/bin
|
||||
ln -sf ${snapraid-runner}/bin/snapraid-runner $out/bin/snapraid-runner'';
|
||||
};
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue