This repository has been archived by the owner on Jun 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aufzeichnung
executable file
·82 lines (77 loc) · 2.06 KB
/
aufzeichnung
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/sh
# /etc/init.d/aufzeichnung
### BEGIN INIT INFO
# Provides: aufzeichnung
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Interactive: true
# Short-Description: Klimaaufzeichnung
# Description: Autostart der Aufzeichnung
### END INIT INFO
case "$1" in
start)
gpio mode 13 out # gelb
gpio mode 12 out # rot
gpio mode 3 out #grün
if [ -f /home/pi/aufzeichnung.lock ]
then
echo "Die Aufzeichnung läuft bereits.\nWenn nicht, lösche aufzeichnung.lock im Home-Verzeichnis"
gpio write 3 0
gpio write 12 1
exit 1
fi
if sudo python /home/pi/Temperaturmessung/Fremddateien/Adafruit_BMP085_auswertung.py |grep -q I2C
then
echo "Der Luftdruck-Sensor wurde nicht gefunden\nDas Programm wurde daher nicht gestartet"
gpio write 3 0
gpio write 12 1
exit 1
fi
echo "Aufzeichnung wird gestartet"
sudo -H -u pi touch /home/pi/aufzeichnung.lock
sudo -H -u pi /home/pi/Temperaturmessung/main.sh > /dev/null 2>> /home/pi/log/aufzeichnung.txt &
gpio write 3 1
gpio write 12 0
;;
stop)
gpio mode 13 out # gelb
gpio mode 12 out # rot
gpio mode 3 out #grün
echo "Aufzeichnung wird beendet"
killall main.sh
rm /home/pi/aufzeichnung.lock
gpio write 3 0
gpio write 12 1
gpio write 13 0
;;
restart)
echo "Aufzeichnung wird beendet"
killall main.sh
gpio write 3 0
gpio write 12 1
rm /home/pi/aufzeichnung.lock
if sudo python /home/pi/Temperaturmessung/Fremddateien/Adafruit_BMP085_auswertung.py |grep -q I2C
then
echo "Der Luftdruck-Sensor wurde nicht gefunden\nDas Programm wurde daher nicht gestartet"
gpio write 3 0
gpio write 12 1
gpio write 13 0
exit 1
fi
echo "Aufzeichnung wird gestartet"
sudo -H -u pi touch /home/pi/aufzeichnung.lock
sudo -H -u pi /home/pi/Temperaturmessung/main.sh > /dev/null 2>> /home/pi/log/aufzeichnung.txt &
gpio write 3 1
gpio write 12 0
gpio write 13 0
;;
*)
echo "Verwendung: /etc/init.d/aufzeichnung {start|stop}"
gpio write 3 0
gpio write 12 1
exit 1
;;
esac
exit 0