Skip to content

Commit

Permalink
feat: add script and service to take picture of pool gauge every minute
Browse files Browse the repository at this point in the history
  • Loading branch information
icecreammatt committed Jan 28, 2024
1 parent e8f0de2 commit 011b117
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
9 changes: 9 additions & 0 deletions hosts/nixos/mini/caddy.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@
}
'';

virtualHosts."pool.c4er.com".extraConfig = ''
tls /mnt/certs/c4er.com/c4er.com.crt /mnt/certs/c4er.com/c4er.com.key
handle_path /* {
root * "/mnt/storage/webroot/pool"
file_server browse
}
'';

virtualHosts."kopia.c4er.com".extraConfig = ''
tls /mnt/certs/c4er.com/c4er.com.crt /mnt/certs/c4er.com/c4er.com.key
Expand Down
22 changes: 22 additions & 0 deletions hosts/nixos/mini/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,28 @@
plasma-browser-integration
print-manager
];

systemd.timers."gauge-check" = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnBootSec = "1m";
OnUnitActiveSec = "1m";
Unit = "gauge-check.service";
};
};

systemd.services."gauge-check" = {
script = ''
TARGET_NAME="/mnt/storage/webroot/pool/pressure-$(date +"%Y%m%d_%H%M%S.%N").jpg"
${pkgs.openssh}/bin/ssh -i /home/matt/.ssh/webcam [email protected] fswebcam -r 1280x1024 --jpeg 90 -D 1 web-cam-shot.jpg
${pkgs.openssh}/bin/scp -i /home/matt/.ssh/webcam [email protected]:web-cam-shot.jpg $TARGET_NAME
'';

serviceConfig = {
Type = "oneshot";
User = "root";
};
};

virtualisation.vmVariant = {
# nixos-rebuild build-vm --flake .#mini
Expand Down

0 comments on commit 011b117

Please sign in to comment.