From: rtrimana Date: Tue, 20 Feb 2018 18:24:35 +0000 (-0800) Subject: Adjusting Makefiles and config files for a master RaspberryPi X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=01541ae949154a8c6bfc488fd50c05d5561ea42b;p=iot2.git Adjusting Makefiles and config files for a master RaspberryPi --- diff --git a/benchmarks/Java/HomeSecurityController/Makefile b/benchmarks/Java/HomeSecurityController/Makefile index 570be5b..6f05a97 100644 --- a/benchmarks/Java/HomeSecurityController/Makefile +++ b/benchmarks/Java/HomeSecurityController/Makefile @@ -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) diff --git a/benchmarks/Java/IrrigationController/Makefile b/benchmarks/Java/IrrigationController/Makefile index a797ab4..e475b38 100644 --- a/benchmarks/Java/IrrigationController/Makefile +++ b/benchmarks/Java/IrrigationController/Makefile @@ -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 diff --git a/benchmarks/Java/Lifxtest/Makefile b/benchmarks/Java/Lifxtest/Makefile index 23f2d56..ade3d14 100644 --- a/benchmarks/Java/Lifxtest/Makefile +++ b/benchmarks/Java/Lifxtest/Makefile @@ -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) diff --git a/benchmarks/Java/SmartLightsController/Makefile b/benchmarks/Java/SmartLightsController/Makefile index 4d26b0e..41b4c55 100644 --- a/benchmarks/Java/SmartLightsController/Makefile +++ b/benchmarks/Java/SmartLightsController/Makefile @@ -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) diff --git a/benchmarks/Java/SpeakerController/Makefile b/benchmarks/Java/SpeakerController/Makefile index 9a3a38a..6617598 100644 --- a/benchmarks/Java/SpeakerController/Makefile +++ b/benchmarks/Java/SpeakerController/Makefile @@ -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 diff --git a/iotjava/Makefile b/iotjava/Makefile index 0939bd7..83ba1ba 100644 --- a/iotjava/Makefile +++ b/iotjava/Makefile @@ -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 diff --git a/localconfig/iotruntime/IoTMaster.config b/localconfig/iotruntime/IoTMaster.config index 9910438..e73967b 100644 --- a/localconfig/iotruntime/IoTMaster.config +++ b/localconfig/iotruntime/IoTMaster.config @@ -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 diff --git a/localconfig/iotruntime/MySQLInterface.config b/localconfig/iotruntime/MySQLInterface.config index 0b07a5b..0edd14d 100644 --- a/localconfig/iotruntime/MySQLInterface.config +++ b/localconfig/iotruntime/MySQLInterface.config @@ -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 index 0000000..8d70bbf --- /dev/null +++ b/localconfig/iotruntime/cleanrun.bash @@ -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 index 0000000..b12794a --- /dev/null +++ b/localconfig/iotruntime/run.bash @@ -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 diff --git a/localconfig/mysql/cameraSet.config b/localconfig/mysql/cameraSet.config index 5798c17..a061abc 100644 --- a/localconfig/mysql/cameraSet.config +++ b/localconfig/mysql/cameraSet.config @@ -1,5 +1,5 @@ -SELECT * FROM -CameraSmart -WHERE -ID='CM1' -; +SELECT * FROM +CameraSmart +WHERE +ID='CM1' +; diff --git a/localconfig/mysql/lifx_light_bulb.config b/localconfig/mysql/lifx_light_bulb.config index eb128f2..11171b0 100644 --- a/localconfig/mysql/lifx_light_bulb.config +++ b/localconfig/mysql/lifx_light_bulb.config @@ -1,6 +1,3 @@ SELECT * FROM LightBulb -WHERE -ID='LB1' ; - diff --git a/others/Mysql/IoTMain.gz b/others/Mysql/IoTMain.gz index 5604d94..287b0ab 100644 Binary files a/others/Mysql/IoTMain.gz and b/others/Mysql/IoTMain.gz differ