This repository has been archived by the owner on Mar 31, 2023. It is now read-only.
forked from snaptec/openWB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathleds.sh
executable file
·110 lines (107 loc) · 2.88 KB
/
leds.sh
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
ledsteuerung() {
ledstatus=$(<ramdisk/ledstatus)
lademodus=$(<ramdisk/lademodus)
ladestatus=$(<ramdisk/ladestatus)
#0 sofort
#1 min pv
#2 nur pv
#3 stop
#4 standby
ledrunning=$(ps aux |grep '[l]eds.py' | awk '{print $2}')
if (( ladestatus == 1 ));then
if (( lademodus == 0 )); then
if [[ $ledstatus != $ledsofort ]]; then
if [ ! -z "$ledrunning" ]; then
sudo kill $(ps aux |grep '[l]eds.py' | awk '{print $2}')
fi
sudo python runs/leds.py $ledsofort &
echo $ledsofort > ramdisk/ledstatus
fi
fi
if (( lademodus == 1 )); then
if [[ $ledstatus != $ledminpv ]]; then
if [ ! -z "$ledrunning" ]; then
sudo kill $(ps aux |grep '[l]eds.py' | awk '{print $2}')
fi
sudo python runs/leds.py $ledminpv &
echo $ledminpv > ramdisk/ledstatus
fi
fi
if (( lademodus == 2 )); then
if [[ $ledstatus != $lednurpv ]]; then
if [ ! -z "$ledrunning" ]; then
echo "kill"
sudo kill $(ps aux |grep '[l]eds.py' | awk '{print $2}')
fi
sudo python runs/leds.py $lednurpv &
echo $lednurpv > ramdisk/ledstatus
fi
fi
if (( lademodus == 3 )); then
if [[ $ledstatus != $ledstop ]]; then
if [ ! -z "$ledrunning" ]; then
sudo kill $(ps aux |grep '[l]eds.py' | awk '{print $2}')
fi
sudo python runs/leds.py $ledstop &
echo $ledstop > ramdisk/ledstatus
fi
fi
if (( lademodus == 4 )); then
if [[ $ledstatus != $ledstandby ]]; then
if [ ! -z "$ledrunning" ]; then
sudo kill $(ps aux |grep '[l]eds.py' | awk '{print $2}')
fi
sudo python runs/leds.py $ledstandby &
echo $ledstandby > ramdisk/ledstatus
fi
fi
else
if (( lademodus == 0 )); then
if [[ $ledstatus != $led0sofort ]]; then
if [ ! -z "$ledrunning" ]; then
sudo kill $(ps aux |grep '[l]eds.py' | awk '{print $2}')
fi
sudo python runs/leds.py $led0sofort &
echo $led0sofort > ramdisk/ledstatus
fi
fi
if (( lademodus == 1 )); then
if [[ $ledstatus != $led0minpv ]]; then
if [ ! -z "$ledrunning" ]; then
sudo kill $(ps aux |grep '[l]eds.py' | awk '{print $2}')
fi
sudo python runs/leds.py $led0minpv &
echo $led0minpv > ramdisk/ledstatus
fi
fi
if (( lademodus == 2 )); then
if [[ $ledstatus != $led0nurpv ]]; then
if [ ! -z "$ledrunning" ]; then
echo "kill"
sudo kill $(ps aux |grep '[l]eds.py' | awk '{print $2}')
fi
sudo python runs/leds.py $led0nurpv &
echo $led0nurpv > ramdisk/ledstatus
fi
fi
if (( lademodus == 3 )); then
if [[ $ledstatus != $led0stop ]]; then
if [ ! -z "$ledrunning" ]; then
sudo kill $(ps aux |grep '[l]eds.py' | awk '{print $2}')
fi
sudo python runs/leds.py $led0stop &
echo $led0stop > ramdisk/ledstatus
fi
fi
if (( lademodus == 4 )); then
if [[ $ledstatus != $led0standby ]]; then
if [ ! -z "$ledrunning" ]; then
sudo kill $(ps aux |grep '[l]eds.py' | awk '{print $2}')
fi
sudo python runs/leds.py $led0standby &
echo $led0standby > ramdisk/ledstatus
fi
fi
fi
}