-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenv_log.sh
49 lines (39 loc) · 1.28 KB
/
env_log.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
#/bin/bash
python /home/pi/env_logging/stbtnstat.py > /dev/null &
sudo i2cset -y 1 0x3e 0 0x38 0x39 0x14 0x70 0x56 0x6c i
sudo i2cset -y 1 0x3e 0 0x38 0x0d 0x01 i
sudo i2cset -y 1 0x3e 0x40 0x4d 0x6f 0x6e 0x69 0x74 0x6f 0x72 i
sudo i2cset -y 1 0x3e 0x00 0xc0 i
sudo i2cset -y 1 0x3e 0x40 0x77 0x61 0x69 0x74 i
while true
do
BTCK=`ps -ef | grep "stbtnstat.py" | grep -v grep | wc -l`
if [ ${BTCK} = 0 ]; then
python /home/pi/env_logging/disp_env.py > /home/pi/env_logging/`date "+%Y%m%d%H%M"`_templog.csv &
LOGPID=$!
break
fi
sleep 1
done
python /home/pi/env_logging/btnstat.py > /dev/null &
while true
do
BTCK=`ps -ef | grep "btnstat.py" | grep -v grep | wc -l`
if [ ${BTCK} = 0 ]; then
sync
kill -INT $LOGPID
sleep 7
break
fi
sync
sleep 1
done
sudo i2cset -y 1 0x3e 0 0x38 0x39 0x14 0x70 0x56 0x6c i
sudo i2cset -y 1 0x3e 0 0x38 0x0d 0x01 i
sudo i2cset -y 1 0x3e 0x40 0x53 0x68 0x75 0x74 i
sudo i2cset -y 1 0x3e 0x00 0xc0 i
sudo i2cset -y 1 0x3e 0x40 0x44 0x6f 0x77 0x6e 0x21 0x21 i
sleep 2
sudo i2cset -y 1 0x3e 0 0x38 0x39 0x14 0x70 0x56 0x6c i
sudo i2cset -y 1 0x3e 0 0x38 0x0d 0x01 i
sudo shutdown -h now