Skip to content

Commit

Permalink
Update script.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaaker authored Dec 31, 2023
1 parent 6e7fbdd commit cbb6687
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions dump1090_status/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
# License: https://github.com/Isaaker/isaaker-shell-scripts/blob/main/LICENSE.txt
# RUN AS SUDO

# Check Aircraft files exist
# check aircraft file exist
if [ ! -f /run/dump1090-fa/aircraft.json ]; then
#Wall
wall "[$(date +"%d-%m-%Y %H:%M:%S")] Dump1090 stopped running, restarting services"

#Log
sudo echo "[$(date +"%d-%m-%Y %H:%M:%S")] Dump1090 stopped running" > /var/log/dump1090_restart_log.txt
sudo echo "[$(date +"%d-%m-%Y %H:%M:%S")] Dump1090 stopped running" >> /var/log/dump1090_restart_log.txt

#Restarting Services
systemctl restart dump1090-fa.service
Expand All @@ -21,22 +21,23 @@ systemctl restart piaware.service
exit 1
fi

# Check Aircraft Attribute
# Check .aircraft contains current tracked aircrafts
if jq '.aircraft | length > 0' /run/dump1090-fa/aircraft.json; then
#Wall
wall "[$(date +"%d-%m-%Y %H:%M:%S")] Dump1090 still running"

#Log
sudo echo "[$(date +"%d-%m-%Y %H:%M:%S")] Dump1090 still running" > /var/log/dump1090_restart_log.txt
sudo echo "[$(date +"%d-%m-%Y %H:%M:%S")] Dump1090 still running" >> /var/log/dump1090_restart_log.txt

exit 0

else

#Wall
wall "[$(date +"%d-%m-%Y %H:%M:%S")] Dump1090 stopped running, restarting services"

#Log
sudo echo "[$(date +"%d-%m-%Y %H:%M:%S")] Dump1090 stopped running" > /var/log/dump1090_restart_log.txt
sudo echo "[$(date +"%d-%m-%Y %H:%M:%S")] Dump1090 stopped running" >> /var/log/dump1090_restart_log.txt

#Restarting Services
systemctl restart dump1090-fa.service
Expand Down

0 comments on commit cbb6687

Please sign in to comment.