From c1a56fa80b416469501b6d454c32b940e5a5ffc6 Mon Sep 17 00:00:00 2001
From: Stefan Haun <tux@netz39.de>
Date: Wed, 2 Nov 2022 20:57:39 +0100
Subject: [PATCH] Add reboot/unstuck script for wittgenstein

---
 files/wittgenstein/reboot.sh  | 22 ++++++++++++++++++++++
 files/wittgenstein/unstuck.sh |  7 +++++++
 2 files changed, 29 insertions(+)
 create mode 100755 files/wittgenstein/reboot.sh
 create mode 100755 files/wittgenstein/unstuck.sh

diff --git a/files/wittgenstein/reboot.sh b/files/wittgenstein/reboot.sh
new file mode 100755
index 0000000..e463089
--- /dev/null
+++ b/files/wittgenstein/reboot.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games'
+
+echo 'switch-on.sh'
+/home/pi/switch-on.sh
+
+echo 'start i2c-foo'
+sudo modprobe i2c_dev
+sudo modprobe i2c_bcm2708
+
+# wait for network devices
+sleep 30
+
+cd /home/pi
+echo 'start ampel controller'
+tmux new-session -s ampel 'cd /home/pi/netz39_space_notification/raspberry/ledcontrol && ./ledcontrol'
+
+echo 'start lever controller'
+tmux new-window -t ampel:1 'cd /home/pi/netz39_space_notification/raspberry/statusswitch && ./statusswitch'
+
+#echo 'start spaceapi controller'
+#tmux new-window -t ampel:2 'cd /home/pi/netz39_space_notification/SpaceAPI && ./update-json.py --server=platon'
diff --git a/files/wittgenstein/unstuck.sh b/files/wittgenstein/unstuck.sh
new file mode 100755
index 0000000..29da941
--- /dev/null
+++ b/files/wittgenstein/unstuck.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+logger -t unstuck "unstuck $(date)"
+
+killall tmux
+
+sleep 1
+/home/pi/reboot.sh