From 0f3e6e8ca6ff476d450e13e2842fc2558e00aeda Mon Sep 17 00:00:00 2001 From: Rex Garland Date: Sat, 25 Nov 2023 22:51:54 -0800 Subject: [PATCH] Wait for network before running reboot script --- rpi/build.sh | 2 ++ rpi/services/reboot-email.service | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/rpi/build.sh b/rpi/build.sh index de00801..33efb11 100755 --- a/rpi/build.sh +++ b/rpi/build.sh @@ -6,6 +6,8 @@ install_scripts() { mount_services() { sudo cp services/reboot-email.service /etc/systemd/system/reboot-email.service + # Just in case, to make this totally repeatable, remove any local edits + sudo rm -rf /etc/systemd/system/reboot-email.service.d sudo systemctl enable reboot-email } diff --git a/rpi/services/reboot-email.service b/rpi/services/reboot-email.service index 5f11863..9dc42a0 100644 --- a/rpi/services/reboot-email.service +++ b/rpi/services/reboot-email.service @@ -1,8 +1,10 @@ [Unit] Description=Security camera reboot email +Wants=network-online.target +After=network-online.target [Service] Type=simple ExecStart=/bin/bash /usr/bin/security-cam/send-reboot-email.sh EnvironmentFile=/etc/security-cam/vars.sh [Install] -WantedBy=multi-user.target +WantedBy=multi-user.target \ No newline at end of file -- 2.45.2