forked from openenergymonitor/emonpi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rc.local
executable file
·37 lines (29 loc) · 1005 Bytes
/
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
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
/usr/bin/printf " My IP address is\033[0;31m `/sbin/ifconfig | grep "inet addr" | grep -v "127.0.0.1" | awk '{ print $2 }' | awk -F: '{ print $2 }'` \033[0m\n" > /dev/console
# Open openHAB port
sudo iptables -A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT
# Open MQTT Port
sudo iptables -A INPUT -p tcp -m tcp --dport 1883 -j ACCEPT
# Open NodeRED port
sudo iptables -A INPUT -p tcp -m tcp --dport 1880 -j ACCEPT
# Setup logfiles in tmpfs
sudo mkdir /var/log/openhab
sudo chmod 666 /var/log/openhab
sudo touch /var/log/emoncms.log
sudo chmod 666 /var/log/emoncms.log
# Run emonPi Update of first factory boot
/home/pi/emonpi/./firstbootupdate
# Start openHAB
/etc/init.d/openhab start
exit 0