X-Git-Url: http://git.scottworley.com/syncthing-autoregister/blobdiff_plain/1d5d76e472df2f4d24f153f0cd381d7b7d579f91..4ac4946095213d617adde6b5e7067298c61e6df9:/modules/syncthing-autoregister.nix diff --git a/modules/syncthing-autoregister.nix b/modules/syncthing-autoregister.nix index da9df86..ad710f6 100644 --- a/modules/syncthing-autoregister.nix +++ b/modules/syncthing-autoregister.nix @@ -45,6 +45,20 @@ in { ExecStart = register-script; }; }; + systemd.services.syncthing-reregister = { + after = [ "syncthing-autoregister.service" ]; + script = '' + ${pkgs.coreutils}/bin/sleep 1 + ${pkgs.systemd}/bin/systemctl restart syncthing-autoregister + ''; + serviceConfig = { + Type = "oneshot"; + }; + }; + systemd.paths.syncthing-reregister = { + pathConfig.PathChanged = cfg.path; + wantedBy = [ "multi-user.target" ]; + }; }; }