add rysnc immich library sync service
This commit is contained in:
@@ -44,6 +44,11 @@ in {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = "immich-server";
|
||||
};
|
||||
library_sync_dir = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "/holocron/users/blake/pictures/library";
|
||||
description = "set directory to automatically rsync library to storage pool";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
@@ -76,6 +81,31 @@ in {
|
||||
#settings.server.externalDomain = "https://photos.blakedheld.xyz";
|
||||
};
|
||||
|
||||
systemd.services.immich_library_sync = {
|
||||
description = "twice daily sync immich library to holocron";
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = service;
|
||||
};
|
||||
|
||||
script = ''
|
||||
rsync -a --delete \
|
||||
--chown=blake:blake \
|
||||
/var/lib/immich/library/blake/ \
|
||||
/holocron/users/blake/pictures/library/
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.timers.immich_library_sync = {
|
||||
wantedBy = ["timers.target"];
|
||||
timerConfig = {
|
||||
OnBootSec = "5m";
|
||||
OnUnitActiveSec = "12h";
|
||||
Persistent = true;
|
||||
};
|
||||
};
|
||||
|
||||
# override umask to make permissions work out
|
||||
# systemd.services."${toString service}-server".serviceConfig = {
|
||||
# UMask = lib.mkForce "0007";
|
||||
|
||||
Reference in New Issue
Block a user