hosts/skycam: add archiver script
All checks were successful
Check flake / build-amd64-linux (push) Successful in 1m16s
All checks were successful
Check flake / build-amd64-linux (push) Successful in 1m16s
This commit is contained in:
@ -31,6 +31,33 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemd.services.skycam-archiver =
|
||||||
|
let
|
||||||
|
snapshotScript = pkgs.writeShellScript "skycam-archiver" ''
|
||||||
|
${pkgs.lib.getExe pkgs.curl} -s -o "/var/lib/skycam-archiver/snapshot-$(date +%Y%m%d-%H%M%S).jpg" "http://skycam.mesh.vimium.net:1984/api/frame.jpeg?src=rpicam"
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
{
|
||||||
|
description = "Capture skycam snapshot and save with timestamp";
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
StateDirectory = "skycam-archiver";
|
||||||
|
ExecStart = "${snapshotScript}";
|
||||||
|
};
|
||||||
|
requires = [ "go2rtc.service" ];
|
||||||
|
after = [ "go2rtc.service" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.timers.skycam-archiver = {
|
||||||
|
description = "Timer for capturing skycam snapshots every 30 minutes";
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
timerConfig = {
|
||||||
|
OnBootSec = "5min";
|
||||||
|
OnUnitActiveSec = "30min";
|
||||||
|
Unit = "skycam-archiver.service";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
git
|
git
|
||||||
neovim
|
neovim
|
||||||
|
Reference in New Issue
Block a user