diff --git a/automated_shutdown/shutdown-on-eth-fail.service b/automated_shutdown/shutdown-on-eth-fail.service new file mode 100644 index 0000000..0856a3a --- /dev/null +++ b/automated_shutdown/shutdown-on-eth-fail.service @@ -0,0 +1,13 @@ +/etc/systemd/system/shutdown-on-eth-fail.service + + +[Unit] +Description=Shutdown on Ethernet Failure +After=eth-monitor.service + +[Service] +Type=oneshot +ExecStart=/bin/sh -c 'if [ $(journalctl -u eth-monitor.service --since "5 minutes ago" | grep -c "is down") -ge 5 ]; then /sbin/shutdown -h now; fi' + +[Install] +WantedBy=multi-user.target \ No newline at end of file