From 33ccd4b4e735384e9e0f24583b3fd082bd6a0476 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Mon, 3 Apr 2023 19:12:11 +0200 Subject: Switch to timer --- modules/auto-redeploy.nix | 20 ++++++++++++++++---- 1 file 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"; }; }; -- cgit 1.4.1