From 785888c269c76b363d7ac837fc4cd4448c9790e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isaac=20Hern=C3=A1n?= <77550577+Isaaker@users.noreply.github.com> Date: Sun, 31 Dec 2023 13:46:34 +0100 Subject: [PATCH] Create script.sh --- dump1090_restart/script.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 dump1090_restart/script.sh diff --git a/dump1090_restart/script.sh b/dump1090_restart/script.sh new file mode 100644 index 0000000..4438b3c --- /dev/null +++ b/dump1090_restart/script.sh @@ -0,0 +1,29 @@ +#!/bin/bash +#Created by: Isaaker +#Font code: https://github.com/Isaaker/isaaker-shell-scripts/tree/main +#License: CC BY-NC-ND 4.0 + +if pgrep “dump1090” > /dev/null +then + +#Wall +wall "[$(date +"%d-%m-%Y %H:%M:%S")] Dump1090 still running" -s "Dump1090 Service" + +#Log +echo "[$(date +"%d-%m-%Y %H:%M:%S")] Dump1090 still running" > /home/radar/dump1090_restart_log.txt + +else + +#Wall +wall "[$(date +"%d-%m-%Y %H:%M:%S")] Dump1090 stopped running, restarting services" -s "Dump1090 Service" + +#Log +echo "[$(date +"%d-%m-%Y %H:%M:%S")] Dump1090 stopped running" > /home/radar/dump1090_restart_log.txt + +#Restarting Services +systemctl restart dump1090-fa.service +systemctl restart rbfeeder.service +systemctl restart fr24feeder.service +systemctl restart piaware.service + +fi