Compare commits
2 Commits
c0be9a1c26
...
0454426db5
Author | SHA1 | Date | |
---|---|---|---|
0454426db5
|
|||
aacecab4e3
|
@@ -27,34 +27,55 @@
|
|||||||
{
|
{
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
|
log.level = "debug";
|
||||||
streams.rpicam = "exec:${rpicam-vid} -v1 -t0 -o- --inline --width=4608 --height=2592 --framerate=14 --codec mjpeg --quality 90 --denoise=cdn_off --sharpness 1.25 --exposure long --gain 3";
|
streams.rpicam = "exec:${rpicam-vid} -v1 -t0 -o- --inline --width=4608 --height=2592 --framerate=14 --codec mjpeg --quality 90 --denoise=cdn_off --sharpness 1.25 --exposure long --gain 3";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.skycam-archiver =
|
systemd.services = {
|
||||||
let
|
daily-reboot = {
|
||||||
snapshotScript = pkgs.writeShellScript "skycam-archiver" ''
|
description = "Daily system reboot";
|
||||||
${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 = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
StateDirectory = "skycam-archiver";
|
ExecStart = "/run/current-system/sw/bin/reboot";
|
||||||
ExecStart = "${snapshotScript}";
|
Restart = "no";
|
||||||
};
|
};
|
||||||
requires = [ "go2rtc.service" ];
|
|
||||||
after = [ "go2rtc.service" ];
|
|
||||||
};
|
};
|
||||||
|
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 = {
|
systemd.timers = {
|
||||||
description = "Timer for capturing skycam snapshots every 30 minutes";
|
daily-reboot = {
|
||||||
wantedBy = [ "timers.target" ];
|
description = "Timer for daily system reboot";
|
||||||
timerConfig = {
|
wantedBy = [ "timers.target" ];
|
||||||
OnBootSec = "5min";
|
timerConfig = {
|
||||||
OnUnitActiveSec = "30min";
|
OnCalendar = "*-*-* 03:00:00";
|
||||||
Unit = "skycam-archiver.service";
|
Persistent = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
skycam-archiver = {
|
||||||
|
description = "Timer for capturing skycam snapshots every 30 minutes";
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
timerConfig = {
|
||||||
|
OnBootSec = "5min";
|
||||||
|
OnUnitActiveSec = "30min";
|
||||||
|
Unit = "skycam-archiver.service";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user