Copy service scripts for the gatekeeper user

This commit is contained in:
Stefan Haun 2022-07-23 17:37:45 +02:00
parent fbde9090a9
commit f1e8d52719
5 changed files with 81 additions and 0 deletions

7
files/platon/i2cspeed.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/bash
# https://gist.github.com/ribasco/c22ab6b791e681800df47dd0a46c7c3a
var="$(xxd -ps /sys/class/i2c-adapter/i2c-1/of_node/clock-frequency)"
var=${var//[[:blank:].\}]/}
printf "%d\n" 0x$var

37
files/platon/reboot.sh Executable file
View file

@ -0,0 +1,37 @@
#!/bin/sh
PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games'
echo 'start i2c-foo'
sudo modprobe i2c_dev
sudo modprobe i2c_bcm2708
echo 'starting log'
tmux new-session -s status -d 'sudo less /var/log/shuttercontrol.log'
cd /home/pi/netz39_rollladensteuerung/raspberry/shuttercontrol
echo 'switch-on.sh'
../switch-on.sh
cd /home/pi
echo 'start shuttercontrol'
tmux new-window -t status:1 'cd /home/pi/netz39_rollladensteuerung/raspberry/shuttercontrol && ./shuttercontrol.sh'
echo 'start watchdog'
tmux new-window -t status:2 'cd /home/pi/netz39_rollladensteuerung/raspberry/doorcontrol && ./door-with-spacestatus.sh'
#tmux new-window -t status:2 'cd /home/pi/netz39_rollladensteuerung/raspberry/door-watchdog && python3 ./door-watchdog.py'
echo 'start door-sound.sh'
tmux new-window -t status:3 'cd /home/pi/netz39_rollladensteuerung/raspberry/doorcontrol && ./door-sound.sh'
echo 'start ic3-client'
tmux new-window -t status:4 'cd /home/pi/netz39_xmpp_space_control/i3c_client && build/i3c_client --foreground'
echo 'start asterisk abuse check'
tmux new-window -t status:5 'cd /home/pi/netz39_rollladensteuerung/raspberry/asterisk && sudo ./check-abuse.sh'
echo 'start asterisk console'
tmux new-window -t status:6 'sudo asterisk -vvvr'
echo 'start door service'
tmux new-window -t status:7 'cd /home/pi/netz39_rollladensteuerung/raspberry/door-service && python3 door-service.py'
echo 'start mqtt-clock'
tmux new-window -t status:8 'cd /home/pi/mqtt-tools/agents && ./mqtt-clock'
#echo 'start ampel controller'
# This does not work as intended xD
#tmux new-window -t status:9 'cd /home/pi/netz39_space_notification/raspberry/ledcontrol && ./ledcontrol'
#echo 'start shuttercontrol-service (experimental)'
#tmux new-window -t status:9 'cd /home/pi && python3 ./shuttercontrol-service.py'

5
files/platon/sesame-open.sh Executable file
View file

@ -0,0 +1,5 @@
#/bin/bash
/home/pi/netz39_rollladensteuerung/raspberry/doorcontrol/door-open.sh
/home/pi/netz39_rollladensteuerung/raspberry/shuttercontrol/doorshutter-open.sh

13
files/platon/unstuck.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash
logger -t unstuck "unstuck $(date)"
killall tmux
gpio mode 2 output
gpio mode 3 output
gpio write 2 0
gpio write 3 0
sudo modprobe -r i2c_dev
sudo modprobe -r i2c_bcm2708
sleep 1
~/reboot.sh

View file

@ -18,6 +18,8 @@
# Should come from ble-keeper-role
# see https://github.com/netz39/ble-keykeeper-role/issues/4
- python3-pip
# Regular packages
- tmux
- name: Set MAC address for proper DHCP recognition
@ -56,3 +58,20 @@
name: "{{ gatekeeper_user }}"
groups: dialout,audio,plugdev,input,netdev,i2c,gpio
append: yes
- name: Copy management scripts
ansible.builtin.copy:
src: "files/platon/{{ item }}"
dest: "/home/{{ gatekeeper_user }}/{{ item }}"
owner: "{{ gatekeeper_user }}"
group: "{{ gatekeeper_user }}"
mode: "0755"
loop:
- i2cspeed.sh
- reboot.sh
- unstuck.sh
- sesame-open.sh
# WiringPi needs to be installed, but that library seems to be
# obsolete, so not automating.
# Follow the instructions on http://wiringpi.com/download-and-install/