jellfin cronjobs

This commit is contained in:
2024-06-14 15:17:11 -06:00
parent a24ed21f39
commit 36cb54390f
3 changed files with 36 additions and 27 deletions

View File

@@ -20,7 +20,10 @@ in {
};
config = {
my.servers = {
jellyfin.enable = lib.mkDefault false;
jellyfin = {
enable = lib.mkDefault false;
enableCron = lib.mkDefault false;
};
nextcloud = {
enable = lib.mkDefault false;
enableCron = lib.mkDefault false;

View File

@@ -3,7 +3,10 @@ let
localhost = config.my.servers.settings.localhost;
port = 8096;
in {
options.my.servers.jellyfin.enable = lib.mkEnableOption "enable";
options.my.servers.jellyfin = {
enable = lib.mkEnableOption "enable";
enableCron = lib.mkEnableOption "enable";
};
config = lib.mkIf config.my.servers.jellyfin.enable {
environment.systemPackages = [ pkgs.jellyfin-ffmpeg ];
services = {
@@ -99,5 +102,33 @@ in {
};
};
};
systemd = lib.mkIf config.my.servers.jellyfin.enableCron {
services = {
sub-sync = let
sub-sync = pkgs.writeScriptBin "nextcloud-cronjob"
(builtins.readFile ../../scripts/sub-sync.sh);
in {
restartIfChanged = true;
description = "syncronizes subtitles downloaded & modified today";
wantedBy = [ "default.target" ];
path = [ pkgs.nix sub-sync ];
serviceConfig = {
Restart = "on-failure";
RestartSec = 30;
ExecStart = "${sub-sync}/bin/sub-sync all";
Type = "forking";
User = "root";
};
};
};
timers = {
sub-sync = {
enable = true;
description = "syncronizes subtitles downloaded & modified today";
wantedBy = [ "timers.target" ];
timerConfig = { OnCalendar = "20:00"; };
};
};
};
};
}