summary refs log tree commit diff
path: root/modules/auto-redeploy.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/auto-redeploy.nix')
-rw-r--r--modules/auto-redeploy.nix20
1 files changed, 16 insertions, 4 deletions
diff --git a/modules/auto-redeploy.nix b/modules/auto-redeploy.nix
index 7cecb93..52decc7 100644
--- a/modules/auto-redeploy.nix
+++ b/modules/auto-redeploy.nix
@@ -1,9 +1,21 @@
 { config, pkgs, lib, secrets, ... }:
 {
+  systemd.timers = {
+    "auto-redeploy" = {
+      wantedBy = [ "timers.target" ];
+      after = [ "network.target" ];
+      timerConfig = {
+        #every 30 seconds since boot
+        OnBootSec = "10s";
+        OnUnitActiveSec = "30s";
+        Unit = "auto-redeploy.service";
+      };
+    };
+  };
   systemd.services = {
     "auto-redeploy" = {
-        wantedBy = [ "multi-user.target" ];
-        after = [ "network.target" ];
+        #wantedBy = [ "multi-user.target" ];
+        #after = [ "network.target" ];
         serviceConfig = {
             ExecStart = ''
               ${pkgs.curl}/bin/curl -H "Content-Type: application/json" -d '{"username": "${config.networking.hostName} - redeploy", "content": "System started redeploy."}' ${secrets.webhooks.discord.deploy}
@@ -30,8 +42,8 @@
               ${pkgs.curl}/bin/curl -F "file=@/tmp/update.log" -F "filename=update.log" -F "content=System finished redeploy." -H "Content-Type: multipart/form-data" ${secrets.webhooks.discord.deploy}
               
               '';
-            Restart = "always";
-            RestartSec = 60;
+            #Restart = "always";
+            #RestartSec = 60;
             User = "root";
         };
     };