Adjusting Makefiles and config files for a master RaspberryPi
authorrtrimana <rtrimana@uci.edu>
Tue, 20 Feb 2018 18:24:35 +0000 (10:24 -0800)
committerrtrimana <rtrimana@uci.edu>
Tue, 20 Feb 2018 18:24:35 +0000 (10:24 -0800)
13 files changed:
benchmarks/Java/HomeSecurityController/Makefile
benchmarks/Java/IrrigationController/Makefile
benchmarks/Java/Lifxtest/Makefile
benchmarks/Java/SmartLightsController/Makefile
benchmarks/Java/SpeakerController/Makefile
iotjava/Makefile
localconfig/iotruntime/IoTMaster.config
localconfig/iotruntime/MySQLInterface.config
localconfig/iotruntime/cleanrun.bash [new file with mode: 0755]
localconfig/iotruntime/run.bash [new file with mode: 0755]
localconfig/mysql/cameraSet.config
localconfig/mysql/lifx_light_bulb.config
others/Mysql/IoTMain.gz

index 570be5b..6f05a97 100644 (file)
@@ -23,13 +23,13 @@ homesecurity:
        $(JAVAC) $(JFLAGS) *.java
        cp HomeSecurityController.config $(BIN_DIR)/HomeSecurityController
        #cp HomeSecurityController.tomoyo $(BIN_DIR)/HomeSecurityController
-       cd $(BIN_DIR)/HomeSecurityController; $(JAR) $(JARFLAGS) HomeSecurityController.jar ../HomeSecurityController/HomeSecurityController*.class ../HomeSecurityController/*.class ../iotcode/interfaces/SmartthingsSensor*.class ../iotcode/interfaces/SmartthingsActuator*.class ../iotcode/interfaces/Camera*.class ../iotcode/interfaces/Alarm*.class ../iotcode/interfaces/Room*.class  ../iotcode/interfaces/ZoneState*.class ../iotcode/interfaces/Resolution*.class; rm -rf *.class
+       cd $(BIN_DIR)/HomeSecurityController; $(JAR) $(JARFLAGS) HomeSecurityController.jar ../HomeSecurityController/HomeSecurityController*.class ../HomeSecurityController/*.class ../iotcode/interfaces/SmartthingsSensor*.class ../iotcode/interfaces/SmartthingsActuator*.class ../iotcode/interfaces/Camera*.class ../iotcode/interfaces/Alarm*.class ../iotcode/interfaces/Room*.class  ../iotcode/interfaces/ZoneState*.class ../iotcode/interfaces/Resolution*.class; mkdir tmp; mv HomeSecurityController.class ./tmp; rm -rf *.class; mv ./tmp/* ./; rm -rf ./tmp
 
 PHONY += check-homesecurity
 check-homesecurity:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) *.java
        cp HomeSecurityController.config $(BIN_DIR)/HomeSecurityController
        #cp HomeSecurityController.tomoyo $(BIN_DIR)/HomeSecurityController
-       cd $(BIN_DIR)/HomeSecurityController; $(JAR) $(JARFLAGS) HomeSecurityController.jar ../HomeSecurityController/HomeSecurityController*.class ../HomeSecurityController/*.class ../iotcode/interfaces/SmartthingsSensor*.class ../iotcode/interfaces/SmartthingsActuator*.class ../iotcode/interfaces/Camera*.class ../iotcode/interfaces/Alarm*.class ../iotcode/interfaces/Room*.class  ../iotcode/interfaces/ZoneState*.class ../iotcode/interfaces/Resolution*.class; rm -rf *.class
+       cd $(BIN_DIR)/HomeSecurityController; $(JAR) $(JARFLAGS) HomeSecurityController.jar ../HomeSecurityController/HomeSecurityController*.class ../HomeSecurityController/*.class ../iotcode/interfaces/SmartthingsSensor*.class ../iotcode/interfaces/SmartthingsActuator*.class ../iotcode/interfaces/Camera*.class ../iotcode/interfaces/Alarm*.class ../iotcode/interfaces/Room*.class  ../iotcode/interfaces/ZoneState*.class ../iotcode/interfaces/Resolution*.class; mkdir tmp; mv HomeSecurityController.class ./tmp; rm -rf *.class; mv ./tmp/* ./; rm -rf ./tmp
 
 .PHONY: $(PHONY)
index a797ab4..e475b38 100644 (file)
@@ -21,7 +21,7 @@ check-all: check-irrigation
 PHONY += irrigation
 irrigation:
        $(JAVAC) $(JFLAGS) *.java
-       cd  $(BIN_DIR)/IrrigationController; $(JAR) $(JARFLAGS) IrrigationController.jar ../IrrigationController/*.class ../iotcode/interfaces/*.class; rm -rf *.class
+       cd  $(BIN_DIR)/IrrigationController; $(JAR) $(JARFLAGS) IrrigationController.jar ../IrrigationController/*.class ../iotcode/interfaces/*.class; mkdir tmp; mv IrrigationController.class ./tmp; rm -rf *.class; mv ./tmp/* ./; rm -rf ./tmp
        cp IrrigationController.config $(BIN_DIR)/IrrigationController
        cp IrrigationController.tomoyo $(BIN_DIR)/IrrigationController
        cp -rf ./resources ./help_files $(BIN_DIR)/IrrigationController
@@ -30,7 +30,7 @@ irrigation:
 PHONY += check-irrigation
 check-irrigation:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) *.java
-       cd  $(BIN_DIR)/IrrigationController; $(JAR) $(JARFLAGS) IrrigationController.jar ../IrrigationController/*.class ../iotcode/interfaces/*.class; rm -rf *.class
+       cd  $(BIN_DIR)/IrrigationController; $(JAR) $(JARFLAGS) IrrigationController.jar ../IrrigationController/*.class ../iotcode/interfaces/*.class; mkdir tmp; mv IrrigationController.class ./tmp; rm -rf *.class; mv ./tmp/* ./; rm -rf ./tmp
        cp IrrigationController.config $(BIN_DIR)/IrrigationController
        cp IrrigationController.tomoyo $(BIN_DIR)/IrrigationController
        cp -rf ./resources ./help_files $(BIN_DIR)/IrrigationController
index 23f2d56..ade3d14 100644 (file)
@@ -20,12 +20,12 @@ PHONY += lifxtest
 lifxtest:
        $(JAVAC) $(JFLAGS) *.java
        cp Lifxtest.config $(BIN_DIR)/Lifxtest
-       cd $(BIN_DIR)/Lifxtest; $(JAR) $(JARFLAGS) Lifxtest.jar ../Lifxtest/Lifxtest*.class ../Lifxtest/LightBulb*.class ../iotcode/LifxLightBulb/*.class ../iotcode/interfaces/LightBulb*.class; rm -rf *.class
+       cd $(BIN_DIR)/Lifxtest; $(JAR) $(JARFLAGS) Lifxtest.jar ../Lifxtest/Lifxtest*.class ../Lifxtest/LightBulb*.class ../iotcode/LifxLightBulb/*.class ../iotcode/interfaces/LightBulb*.class; mkdir tmp; mv Lifxtest.class ./tmp; rm -rf *.class; mv ./tmp/* ./; rm -rf ./tmp
 
 PHONY += check-lifxtest
 check-lifxtest:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) *.java
        cp Lifxtest.config $(BIN_DIR)/Lifxtest
-       cd $(BIN_DIR)/Lifxtest; $(JAR) $(JARFLAGS) Lifxtest.jar ../Lifxtest/Lifxtest*.class ../Lifxtest/LightBulb*.class ../iotcode/LifxLightBulb/*.class ../iotcode/interfaces/LightBulb*.class; rm -rf *.class
+       cd $(BIN_DIR)/Lifxtest; $(JAR) $(JARFLAGS) Lifxtest.jar ../Lifxtest/Lifxtest*.class ../Lifxtest/LightBulb*.class ../iotcode/LifxLightBulb/*.class ../iotcode/interfaces/LightBulb*.class; mkdir tmp; mv Lifxtest.class ./tmp; rm -rf *.class; mv ./tmp/* ./; rm -rf ./tmp
 
 .PHONY: $(PHONY)
index 4d26b0e..41b4c55 100644 (file)
@@ -23,13 +23,13 @@ smartlights:
        $(JAVAC) $(JFLAGS) *.java
        cp SmartLightsController.config $(BIN_DIR)/SmartLightsController
        cp SmartLightsController.tomoyo $(BIN_DIR)/SmartLightsController
-       cd $(BIN_DIR)/SmartLightsController; $(JAR) $(JARFLAGS) SmartLightsController.jar ../SmartLightsController/SmartLightsController*.class ../SmartLightsController/ColorTemperature*.class ../SmartLightsController/MotionDetection*.class ../SmartLightsController/*.class ../iotcode/interfaces/Camera*.class ../iotcode/interfaces/Room*.class ../iotcode/interfaces/LightBulb*.class ../iotcode/interfaces/Resolution*.class; rm -rf *.class
+       cd $(BIN_DIR)/SmartLightsController; $(JAR) $(JARFLAGS) SmartLightsController.jar ../SmartLightsController/SmartLightsController*.class ../SmartLightsController/ColorTemperature*.class ../SmartLightsController/MotionDetection*.class ../SmartLightsController/*.class ../iotcode/interfaces/Camera*.class ../iotcode/interfaces/Room*.class ../iotcode/interfaces/LightBulb*.class ../iotcode/interfaces/Resolution*.class; mkdir tmp; mv SmartLightsController.class ./tmp; rm -rf *.class; mv ./tmp/* ./; rm -rf ./tmp
 
 PHONY += check-smartlights
 check-smartlights:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) *.java
        cp SmartLightsController.config $(BIN_DIR)/SmartLightsController
        cp SmartLightsController.tomoyo $(BIN_DIR)/SmartLightsController
-       cd $(BIN_DIR)/SmartLightsController; $(JAR) $(JARFLAGS) SmartLightsController.jar ../SmartLightsController/SmartLightsController*.class ../SmartLightsController/ColorTemperature*.class ../SmartLightsController/MotionDetection*.class ../SmartLightsController/*.class ../iotcode/interfaces/Camera*.class ../iotcode/interfaces/Room*.class ../iotcode/interfaces/LightBulb*.class ../iotcode/interfaces/Resolution*.class; rm -rf *.class
+       cd $(BIN_DIR)/SmartLightsController; $(JAR) $(JARFLAGS) SmartLightsController.jar ../SmartLightsController/SmartLightsController*.class ../SmartLightsController/ColorTemperature*.class ../SmartLightsController/MotionDetection*.class ../SmartLightsController/*.class ../iotcode/interfaces/Camera*.class ../iotcode/interfaces/Room*.class ../iotcode/interfaces/LightBulb*.class ../iotcode/interfaces/Resolution*.class; mkdir tmp; mv SmartLightsController.class ./tmp; rm -rf *.class; mv ./tmp/* ./; rm -rf ./tmp
 
 .PHONY: $(PHONY)
index 9a3a38a..6617598 100644 (file)
@@ -23,7 +23,7 @@ check-all: check-speaker
 PHONY += speaker
 speaker:
        $(JAVAC) $(JFLAGS) *.java
-       cd  $(BIN_DIR)/SpeakerController; $(JAR) $(JARFLAGS) SpeakerController.jar ../SpeakerController/*.class ../iotcode/interfaces/*.class; rm -rf *.class
+       cd  $(BIN_DIR)/SpeakerController; $(JAR) $(JARFLAGS) SpeakerController.jar ../SpeakerController/*.class ../iotcode/interfaces/*.class; mkdir tmp; mv SpeakerController.class ./tmp; rm -rf *.class; mv ./tmp/* ./; rm -rf ./tmp
        cp SpeakerController.config $(BIN_DIR)/SpeakerController
        cp SpeakerController.tomoyo $(BIN_DIR)/SpeakerController
        zip -r SpeakerController.zip ./music
@@ -32,7 +32,7 @@ speaker:
 PHONY += check-speaker
 check-speaker:
        $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) *.java
-       cd  $(BIN_DIR)/SpeakerController; $(JAR) $(JARFLAGS) SpeakerController.jar ../SpeakerController/*.class ../iotcode/interfaces/*.class; rm -rf *.class
+       cd  $(BIN_DIR)/SpeakerController; $(JAR) $(JARFLAGS) SpeakerController.jar ../SpeakerController/*.class ../iotcode/interfaces/*.class; mkdir tmp; mv SpeakerController.class ./tmp; rm -rf *.class; mv ./tmp/* ./; rm -rf ./tmp
        cp SpeakerController.config $(BIN_DIR)/SpeakerController
        cp SpeakerController.tomoyo $(BIN_DIR)/SpeakerController
        zip -r SpeakerController.zip ./music
index 0939bd7..83ba1ba 100644 (file)
@@ -237,7 +237,7 @@ runtime:
        $(JAVAC) -classpath .:$(RUNTIMEJARS):$(PHONEJARS):$(ZIPJARS) iotruntime/*.java iotruntime/master/*.java iotruntime/slave/*.java iotruntime/messages/*.java iotruntime/stub/*.java iotruntime/zigbee/*.java -d $(BIN_DIR)
        cp ../localconfig/iotruntime/IoTMaster.config $(BIN_DIR)/iotruntime/
        cp ../localconfig/iotruntime/IoTSlave.config $(BIN_DIR)/iotruntime/
-       #cp ../others/sslkey/*.jks $(BIN_DIR)/iotruntime/
+       cp ../localconfig/iotruntime/*.bash $(BIN_DIR)/iotruntime/
        cp -r ../localconfig/mysql $(BIN_DIR)/iotruntime/
        cp -r ../localconfig/tomoyo $(BIN_DIR)/iotruntime/
        [ -d $(BIN_DIR)/iotruntime/log ] || mkdir $(BIN_DIR)/iotruntime/log
index 9910438..e73967b 100644 (file)
@@ -3,10 +3,10 @@
 MAC_ADDRESS=74:da:38:68:72:8a
 IOT_CODE_PATH=./../iotcode/
 CONTROLLERS_CODE_PATH=../
-RUNTIME_DIR=~/iot2/iotjava/iotruntime;
-SLAVE_DIR=~/iot2/iotjava/iotruntime/slave;
-#CLASS_PATH=-cp .:/usr/share/java/*:./../../iotjava/:./../../iotjava/iotruntime/:./../../iotjava/iotinstaller/:./../../iotjava/iotrmi/
-CLASS_PATH=-cp .:/usr/share/java/*:./../:./../iotruntime/:./../iotinstaller/:./../../iotjava/iotrmi/
+RUNTIME_DIR=~/iot2/bin/iotruntime;
+SLAVE_DIR=~/iot2/bin/iotruntime/slave;
+#CLASS_PATH=-cp .:/usr/share/java/*:./../../:./../../iotruntime/:./../../iotinstaller/:./../../iotrmi/
+CLASS_PATH=-cp .:/usr/share/java/*:./../:./../iotruntime/:./../iotinstaller/:./../../iotrmi/
 
 #benchmarks/libs/boofcv_libs/* - we usually put these benchmark codes in /usr/share/java on compute nodes
 #benchmarks/libs/georegression_libs/* - we usually put these benchmark codes in /usr/share/java on compute nodes
@@ -15,7 +15,7 @@ RMI_PATH=-Djava.rmi.server.codebase=file:.:/usr/share/java/*
 RMI_HOSTNAME=-Djava.rmi.server.hostname=
 LOG_FILE_PATH=log/
 USERNAME=iotuser@
-ROUTER_ADD=192.168.2.1
+ROUTER_ADD=192.168.1.1
 
 #The only host that SSH is allowed from to the router
 MONITORING_HOST=74:da:38:68:72:8a
index 0b07a5b..0edd14d 100644 (file)
@@ -4,4 +4,4 @@
 HOST=localhost
 DATABASE=IoTMain
 USERNAME=root
-PASSWORD=root
+PASSWORD=1234
diff --git a/localconfig/iotruntime/cleanrun.bash b/localconfig/iotruntime/cleanrun.bash
new file mode 100755 (executable)
index 0000000..8d70bbf
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/bash
+# Clean the master Raspberry Pi
+echo "Cleaning master!"
+rm -rf *.jar
+rm -rf log/*
+rm -rf *.zip
+rm -rf *.policy
+rm -rf *.sh
+rm -rf *.tomoyo.pol
+rm -rf help_files/ resources/ music/
+cd slave/; rm -rf *.so; rm -rf *.zip; rm -rf *.log;
+sudo pkill -f Djava
+sudo pkill -f IoTSlave
+sudo iptables -F
+sudo tomoyo-loadpolicy -df < /home/iotuser/iot2/bin/iotruntime/clear.tomoyo
+echo "Master cleaned!"
+
+# Clean the slave(s) and router
+SLAVE1="192.168.1.101"
+ROUTER="192.168.1.1"
+RUNTIME_PATH="/home/iotuser/iot2/bin/iotruntime/"
+echo "Cleaning slave!"
+ssh iotuser@$SLAVE1 "cd $RUNTIME_PATH; rm -rf *.sh; rm -rf help_files/; rm -rf music/; rm -rf *.jar;rm -rf log/*; rm -rf *.zip; sudo pkill -f Djava; rm -rf resources/"
+ssh iotuser@$SLAVE1 "cd $RUNTIME_PATH/slave/; rm -rf *.so; rm -rf *.zip; rm -rf *.log;"
+echo "Slave benchmark files cleaned!"
+ssh iotuser@$SLAVE1 "sudo iptables -F"
+echo "Slave iptables cleaned!"
+ssh iotuser@$SLAVE1 "sudo pkill -f IoTSlave"
+echo "Slave processes killed!"
+ssh iotuser@$SLAVE1 "sudo tomoyo-loadpolicy -df < $RUNTIME_PATH/clear.tomoyo"
+echo "Slave process jailer cleaned!"
+
+ssh root@$ROUTER "cd /root/setup; ./clean; ./startup.sh"
+echo "Router cleaned!"
diff --git a/localconfig/iotruntime/run.bash b/localconfig/iotruntime/run.bash
new file mode 100755 (executable)
index 0000000..b12794a
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+#java -cp .:/usr/share/java/*:./../:./../iotcode/:./../iotcode/Lifxtest/ iotruntime.master.IoTMaster Lifxtest
+java -cp .:/usr/share/java/*:./../:./../iotcode/:./../iotcode/Lifxtest/ iotruntime.master.IoTMaster SmartLightsController
+#java -cp .:/usr/share/java/*:./../:./../iotcode/:./../iotcode/Lifxtest/ iotruntime.master.IoTMaster IrrigationController
+#java -cp .:/usr/share/java/*:./../:./../iotcode/:./../iotcode/Lifxtest/ iotruntime.master.IoTMaster SpeakerController
+#java -cp .:/usr/share/java/*:./../:./../iotcode/:./../iotcode/Lifxtest/ iotruntime.master.IoTMaster HomeSecurityController
+
+# Combination
+#java -cp .:/usr/share/java/*:./../:./../iotcode/:./../iotcode/Lifxtest/ iotruntime.master.IoTMaster HomeSecurityController SmartLightsController SpeakerController IrrigationController
index 5798c17..a061abc 100644 (file)
@@ -1,5 +1,5 @@
-SELECT * FROM
-CameraSmart
-WHERE
-ID='CM1'
-;
+SELECT * FROM\r
+CameraSmart\r
+WHERE\r
+ID='CM1'\r
+;\r
index 5604d94..287b0ab 100644 (file)
Binary files a/others/Mysql/IoTMain.gz and b/others/Mysql/IoTMain.gz differ