From 592d864283049e1dcd62f35bdf8e208906c44f64 Mon Sep 17 00:00:00 2001 From: Stefan Haun Date: Sun, 7 Jan 2024 20:29:06 +0100 Subject: [PATCH 1/2] Fix Grafana Kiosk to use killall Fbi seems to fork and continue on another process, as the shown process ID does not match the returned value. Use killall to fix this problem. Note that this only works because nobody else is using fbi on the system. --- templates/hobbes/kiosk.sh.j2 | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) mode change 100755 => 100644 templates/hobbes/kiosk.sh.j2 diff --git a/templates/hobbes/kiosk.sh.j2 b/templates/hobbes/kiosk.sh.j2 old mode 100755 new mode 100644 index e9c7944..5d31810 --- a/templates/hobbes/kiosk.sh.j2 +++ b/templates/hobbes/kiosk.sh.j2 @@ -16,10 +16,11 @@ fbi_pid=0 # Function to be executed on SIGTERM on_sigterm() { echo "SIGTERM received, exiting..." - # Kill the fbi process with the stored PID - if [ $fbi_pid -ne 0 ]; then - sudo kill $fbi_pid - fi + + # Kill the fbi process + # As the process forks itself, we do not get a reliable PID and killall is needed + killall fbi + # Remove the temporary file rm -f /tmp/grafana.png exit 0 @@ -34,13 +35,8 @@ do mosquitto_sub -h $BROKER -t $TOPIC -C 1 > /tmp/grafana.png # Kill the previous fbi process - if [ $fbi_pid -ne 0 ]; then - sudo kill $fbi_pid - fi - - # Display the image using fbi - fbi -T 1 -noverbose -a /tmp/grafana.png & - fbi_pid=$! + # As the process forks itself, we do not get a reliable PID and killall is needed + killall fbi # Wait to avoid a race condition between # fbi starting and mosquitto truncating the file From ab7028784ef289649ef7f4ee6438c2e1f3a6c1cf Mon Sep 17 00:00:00 2001 From: Stefan Haun Date: Sun, 7 Jan 2024 20:32:35 +0100 Subject: [PATCH 2/2] Update grafana-screenshot to version 0.1.0 --- host-radon.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host-radon.yml b/host-radon.yml index 1648adf..79da87c 100644 --- a/host-radon.yml +++ b/host-radon.yml @@ -212,7 +212,7 @@ - name: Setup docker container for Grafana Screenshots docker_container: name: grafana-screenshot - image: mrtux/grafana-screenshot:latest + image: mrtux/grafana-screenshot:0.1.0 pull: true restart_policy: unless-stopped detach: yes