forked from openenergymonitor/emonpi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rc.local_jessieminimal
executable file
·60 lines (49 loc) · 2.11 KB
/
rc.local_jessieminimal
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
#!/bin/sh
#
# rc.local
echo" My IP address is":
hostname -I
# WLAN fix on RasPi 3B+ Stretch
rm /var/run/wpa_supplicant/wlan0
ifdown wlan0
sleep 1
ifup wlan0
# Will only run if /var/log is mounted in tmpfs
if ( mount | grep "on /var/log "| grep -q "^tmpfs " )
then
for i in "redis" "apache2" "mysql" "openhab" "logrotate" "mosquitto" "supervisor" "emonhub" "emoncms"; do mkdir /var/log/"$i"; done
for i in "emoncms.log" "mysql.log" "mqtt_input.log" "redis/redis-server.log" "service-runner.log" "mysql/error.log" "apache2/error.log" "supervisor/supervisord.log" "ntp_update.log"; do touch /var/log/"$i"; done
for i in "emoncms.log" "mysql.log" "mqtt_input.log" "redis/redis-server.log" "service-runner.log" "mysql/error.log" "apache2/error.log" "supervisor/supervisord.log" "ntp_update.log"; do ""chmod 666"" /var/log/"$i"; done
chown -R root:adm /var/log/apache2
chown -R redis:redis /var/log/redis
chown -R mysql:adm /var/log/mysql
chown -R openhab:openhab /var/log/openhab
chown -R pi:pi /var/log/logrotate
chown -R mosquitto:mosquitto /var/log/mosquitto
chown -R dataplicity:dataplicity /var/log/supervisor;
chown -R emonhub:emonhub /var/log/emonhub
chown -R pi:pi /var/log/emoncms
touch /home/pi/data/emonpiupdate.log
ln -s /home/pi/data/emonpiupdate.log /var/log/emoncms/emonpiupdate.log
# Restart random seed process now ~/data RW partition has been mounted
sudo systemctl restart systemd-random-seed.service
# Start / Restart services,they should run happy now log dir's are created
sleep 3
service mysql restart
service redis-server restart
service mosquitto restart
service emonhub restart
service emonPiLCD restart
service apache2 restart
service supervisor restart
service feedwriter restart
service mqtt_input restart
service lwrfd restart
service service-runner restart
service emoncms_mqtt restart
fi
# Run emonPi Update of first factory boot as Pi user (run condition > web connection exisits && ~/data/emonpiu$
su pi -c '/home/pi/emonpi/./firstbootupdate'
## Start Wifi AP (uncomment if required) see emonpi/wifiAP/readme.md
/home/pi/emonpi/wifiAP/startAP.sh
exit 0