forked from openenergymonitor/emonpi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrc.local
executable file
·52 lines (43 loc) · 1.93 KB
/
rc.local
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
#!/bin/sh
#
# rc.local
# rc.local for Raspbian Stretch
echo" My IP address is":
hostname -I
# Create log dirs and files on tempfs partition
# 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" "openhab2" "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 openhab:openhab /var/log/openhab2
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
# 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
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 see emonpi/wifiAP/readme.md
/home/pi/emonpi/wifiAP/startAP.sh
exit 0