forked from sdr-enthusiasts/docker-piaware
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
possible workaround for sdr-enthusiasts#168
- Loading branch information
Showing
5 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
exec /etc/s6-overlay/scripts/watchdog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
longrun |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/command/with-contenv bash | ||
# shellcheck shell=bash disable=SC1091,2154 | ||
|
||
source /scripts/common | ||
|
||
# checking every 60 seconds | ||
sleep 60 | ||
|
||
# check if the current date is larger than the expiry field of the status json | ||
if (( $(date +%s) * 1000 > $(grep -o -E -e '(expiry)" *: ([0-9]+)' /run/piaware/status.json | awk '{print $3}') )); then | ||
# current date being larger means piaware is hanging, kill it | ||
"${s6wrap[@]}" echo "piaware is not updating /run/piaware/status.json, sending SIGKILL" | ||
pkill -9 piaware | ||
fi | ||
|
||
|
||
# make sure /var/log/piaware/current doesn't grow too large | ||
if (( $(wc -l < /var/log/piaware/current) > 400 )); then | ||
keep=$(tail -n200 /var/log/piaware/current) | ||
truncate -s 0 /var/log/piaware/current | ||
cat >> /var/log/piaware/current <<< "$keep" | ||
fi |