/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