From 214c29312897a173027dd2b2e3473bac1c2f4947 Mon Sep 17 00:00:00 2001 From: materus Date: Sat, 6 Apr 2024 09:21:05 +0200 Subject: [PATCH] valkyrie: slice archive timer to 3 units --- .../host/valkyrie/secrets/private/tosave.nix | Bin 2676 -> 2674 bytes .../host/valkyrie/services/secureyoursoul.nix | 76 ++++++++++++++++-- 2 files changed, 71 insertions(+), 5 deletions(-) diff --git a/configurations/host/valkyrie/secrets/private/tosave.nix b/configurations/host/valkyrie/secrets/private/tosave.nix index eb38f61e3f181b4a92a713dc5abdb9fdc9e45e57..36d89980257dad925b23deab9265068df0242473 100644 GIT binary patch literal 2674 zcmV-&3XSyuM@dveQdv+`0I%5`*p$Fw`@e8Oldz*YGWrMRxJiFD8r~gWmK&2w0hUid zfx<${w9>=~)??8`7%T$Fmk(^(8xAXA(*U%iY?TApAO_zmI zZ504RehE3z!3Gc0>yw7NL(s9OmDHkod^$IDY1&1O@_j zv|$zwt5VqC8^~ft@2lW^yFsgA;{?9cx>RtV%>`&@;;mu}`hInV`k-kovq6(YR~rQk z%z6{xxru{#Kh85A!D?knox5i<{*h@OU%QlW4A(_UWJ3N}PA*GTj1j^4dMf4qUiY1V z%C|!b988F>=?sDY1xMJ_j-hI1MkK;27jdDP|R%S-C|Z+?I3jPkGegoMIr z4tO+F5Hdj}gcQK>nY@1h6q#X-8v!yCnrF}8-$oV0ZV$CO!GX%)>9g*Hnr1W7`SHkl zb{$VqKtobSy-8UZ=GGh2;ygKMSiBkBv@AV^9%mRdOgOBIYl!Fhnl+%d5@S$Pxz?l{)k3n(c(2>ob9{Faz zBfM1g)LhCV;*ftXC|;@(-^A--3>itJ(|Z-;0N%zAHMftUszKkfgYR@9?kd1 znAn%uZSOqQ{=l%lLTmgLu>jSsS9lWcfn>h^*R3pG1h#JuCF9pZlBDmXec9#ZR0In^ zpzV;>(dv+>V}Cyps5Vd#x(zP3edYq)!6y~NxRrvak^LA_i~@_~5FzDBPjf_r=F#$L zii)J6`!=0105@FudX3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@cGx)M{_Nk>BBB45E3yf{a#6{66!E z&Sp{)j3l-77;;c+NBTv()b?ptoK6ro+=RW+;Ka2gW==BH4>^ z$60u==~n7C#@x0Jo)r(u1FD_!^g64KB>7O9EU4fjy9{MQLZXmA#BsP??RKN8=@4(n zqv6WAmr}l$6Nk-(V6@4o8WOes^1X-g*dvO}Dt&{Bnh}=IjX6x}R&b{eYwa=ka zj4Gc%fT{U!@5H5#tUN5JRWvHMJ>WH9YK;>GYupwLP$B(o5yXm5c7qq3&p|mjXHu$- z)Pq!s)=zA@AT_6KA^_~=-xNJn(9nD88`0YQ4Nuztk_a>`s&|veS(;?NULpMe(gPcc zvE98{=$HazXRtBRb&dBS594|vWkD6qr4;?o!F_(3_^czs$u7o idwt?=u0Gvyu`&?z#@W{?V^5j2$|=Ks>MkLErkuXus4p1+ diff --git a/configurations/host/valkyrie/services/secureyoursoul.nix b/configurations/host/valkyrie/services/secureyoursoul.nix index 8dc25a3..d888fea 100644 --- a/configurations/host/valkyrie/services/secureyoursoul.nix +++ b/configurations/host/valkyrie/services/secureyoursoul.nix @@ -10,23 +10,39 @@ cfg = config.valkyrieService.secureyoursoul; in lib.mkIf cfg.enable { - systemd.timers.secureyoursoul = { + systemd.timers.secureyoursoul-steam = { wantedBy = [ "timers.target" ]; timerConfig = { OnCalendar = "*-*-1,7,14,21 3:00:00"; Persistent = true; - Unit = "secureyoursoul.service"; + Unit = "secureyoursoul-steam.service"; + }; + }; + systemd.timers.secureyoursoul-p1 = { + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar = "*-*-3,9,16,23 3:00:00"; + Persistent = true; + Unit = "secureyoursoul-p1.service"; + }; + }; + systemd.timers.secureyoursoul-p2 = { + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar = "*-*-5,11,18,25 3:00:00"; + Persistent = true; + Unit = "secureyoursoul-p2.service"; }; }; - systemd.services.secureyoursoul = { - description = "Make curl requests to archive related things"; + systemd.services.secureyoursoul-steam = { + description = "Make curl requests to archive steam related things"; path = [ pkgs.coreutils pkgs.util-linux pkgs.curl ]; serviceConfig.Type = "oneshot"; serviceConfig.RemainAfterExit = false; script = '' STEAM_IDS=( ${ builtins.foldl' (x: y: x +"\""+ y + "\" ") "" materusArg.to_save.steamids }) - EXTRA_LINKS=( ${ builtins.foldl' (x: y: x +"\""+ y + "\" ") "" materusArg.to_save.extraLinks }) + EXTRA_LINKS=( ${ builtins.foldl' (x: y: x +"\""+ y + "\" ") "" materusArg.to_save.extraLinks-steam }) steamladder() { for id in ''${STEAM_IDS[@]}; do @@ -69,6 +85,56 @@ ''; }; + + systemd.services.secureyoursoul-p1 = { + description = "Make curl requests to archive related things"; + path = [ pkgs.coreutils pkgs.util-linux pkgs.curl ]; + serviceConfig.Type = "oneshot"; + serviceConfig.RemainAfterExit = false; + script = '' + EXTRA_LINKS=( ${ builtins.foldl' (x: y: x +"\""+ y + "\" ") "" materusArg.to_save.extraLinks1 }) + webarchive(){ + for link in ''${EXTRA_LINKS[@]}; do + curl -X POST -H "Accept: application/json" \ + -H "Authorization: LOW ''$(cat ${config.sops.secrets.webarchive-accesskey.path}):''$(cat ${config.sops.secrets.webarchive-secretkey.path})" \ + -d"url=$link" \ + -d"capture_outlinks=1" \ + -d"capture_screenshot=on" \ + -d"capture_all=on" \ + "https://web.archive.org/save"; + sleep 180; + done; + + } + webarchive + ''; + }; + + systemd.services.secureyoursoul-p2 = { + description = "Make curl requests to archive related things - part 2"; + path = [ pkgs.coreutils pkgs.util-linux pkgs.curl ]; + serviceConfig.Type = "oneshot"; + serviceConfig.RemainAfterExit = false; + script = '' + EXTRA_LINKS=( ${ builtins.foldl' (x: y: x +"\""+ y + "\" ") "" materusArg.to_save.extraLinks2 }) + webarchive(){ + for link in ''${EXTRA_LINKS[@]}; do + curl -X POST -H "Accept: application/json" \ + -H "Authorization: LOW ''$(cat ${config.sops.secrets.webarchive-accesskey.path}):''$(cat ${config.sops.secrets.webarchive-secretkey.path})" \ + -d"url=$link" \ + -d"capture_outlinks=1" \ + -d"capture_screenshot=on" \ + -d"capture_all=on" \ + "https://web.archive.org/save"; + sleep 180; + done; + + } + webarchive + ''; + }; + + };