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 570be5b4c11ee14119b1a84c9f9e371f4224c502..6f05a97b8b900314b1a7e9474c728d8edd9d50ae 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 a797ab4169a46514bd97d92b92101b44a8f887ee..e475b382c4f78eb1469dad1cdecd94d7171b70d9 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 23f2d56f38833450ca6d5f65d13d2afca8001d6e..ade3d1419c345d49070f0a98144dfb284f69a9fd 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 4d26b0e8d50f7d10518c8d780fd0134479fb2aa8..41b4c5514e9b234da69780570416235b1debb690 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 9a3a38a3c27a2451089e47013a5ddfe859a0c4be..66175989f319efb71d6e15447c6925be9c5ec73b 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 0939bd72d576d0583d35eb3363b74ee055700109..83ba1ba24a81244e8b41463eae568054d150b8bc 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 9910438dd3aa64917ae37ec8ffc9814e005ab778..e73967bbba60f9fc3a75a4323fee405de3245849 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 0b07a5b622cb16e4fbccdea9403e3cdbd63011fc..0edd14d898fc572f35ec6ad565d946d93df9fb0a 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 5798c171313152480bc35c4628c6ee76e3206fbd..a061abc4313074cabb0c09aaaadaac1fbbadacaa 100644 (file)
@@ -1,5 +1,5 @@
-SELECT * FROM
-CameraSmart
-WHERE
-ID='CM1'
-;
+SELECT * FROM\r
+CameraSmart\r
+WHERE\r
+ID='CM1'\r
+;\r
index eb128f20a091f9a17822850bb99928dd4b01ae79..11171b07f81b6f0a1a108bdb908347c7bfd9bf4d 100644 (file)
@@ -1,6 +1,3 @@
 SELECT * FROM
 LightBulb
-WHERE
-ID='LB1'
 ;
-
index 5604d94dc3d2f192d392eae8fb95c599a2792660..287b0ab5c5b8b729fd4bf9e79e2cdbc496f97819 100644 (file)
Binary files a/others/Mysql/IoTMain.gz and b/others/Mysql/IoTMain.gz differ