forked from openenergymonitor/emonpi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate
More file actions
executable file
·97 lines (70 loc) · 1.64 KB
/
update
File metadata and controls
executable file
·97 lines (70 loc) · 1.64 KB
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
#!/bin/bash
# If update flag does not exit then exit
if [ ! -f /tmp/emonpiupdate ]; then
exit
fi
LOCK=/tmp/updatelock
if [ -f $LOCK ]; then
echo Job is already running\!
exit 6
fi
touch $LOCK
# Make FS RW
rpi-rw
# Clear log update file
cat /dev/null > /home/pi/data/emonpiupdate.log
# Stop emonPi LCD servcice
sudo /etc/init.d/emonPiLCD stop
# Display update message on LCD
sudo /home/pi/emonpi/lcd/./emonPiLCD_update.py
echo "Starting emonPi Update >"
echo
# Date and time
date
echo
echo "git pull /home/pi/emonpi"
cd /home/pi/emonpi
git pull
echo "git pull /home/pi/RFM2Pi"
cd /home/pi/RFM2Pi
git pull
echo "git pull /home/pi/emonhub"
cd /home/pi/emonhub
git pull
echo "git pull /home/pi/oem_openHab"
cd /home/pi/oem_openHab
git pull
echo "git pull /home/pi/oem_node-red"
cd /home/pi/oem_node-red
git pull
echo "git pull /var/www/emoncms/usefulscripts"
cd /home/pi/usefulscripts
git pull
echo
echo "Start emonPi Atmega328 firmware update:"
# Run emonPi update script to update firmware on Atmega328 on emonPi Shield using avrdude
/home/pi/emonpi/emonpiupdate
echo
echo
echo "Start emonhub update script:"
# Run emonHub update script to update emonhub.conf nodes
/home/pi/emonpi/emonhubupdate
echo
echo "Start emoncms update:"
# Run emoncms update script to pull in latest emoncms & emonhub updates
/home/pi/emonpi/emoncmsupdate
echo
echo
# Wait for update to finish
sleep 30
echo "Start emonPi LCD service"
sudo /etc/init.d/emonPiLCD start
# Remove update flag now update has finished
sudo rm /tmp/emonpiupdate
printf "\n...................\n"
printf "emonPi update done\n"
date
echo
rm $LOCK
# Put file system back into read-only
rpi-ro