Merge pull request 'Some fixes for the Hobbes kiosk' (#296) from hobbes-kiosk-fixes into master

Reviewed-on: Netz39_Admin/netz39-infra-ansible#296
Reviewed-by: dkdent <dkdent@netz39.de>
This commit is contained in:
Stefan Haun 2024-01-08 17:36:03 +01:00
commit 780f91dc1a
2 changed files with 8 additions and 12 deletions

View file

@ -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

18
templates/hobbes/kiosk.sh.j2 Executable file → Normal file
View file

@ -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