Completing run.bash; completing the documentation of Raspberry Pi master and slave...
[iot2.git] / localconfig / iotruntime / cleanrun.bash
1 #!/bin/bash
2 # Clean the master Raspberry Pi
3 echo "Cleaning master!"
4 rm -rf *.jar
5 rm -rf log/*
6 rm -rf *.zip
7 rm -rf *.policy
8 rm -rf *.sh
9 rm -rf *.tomoyo.pol
10 rm -rf help_files/ resources/ music/
11 cd slave/; rm -rf *.so; rm -rf *.zip; rm -rf *.log;
12 sudo pkill -f Djava
13 sudo pkill -f IoTSlave
14 sudo iptables -F
15 sudo tomoyo-loadpolicy -df < /home/iotuser/iot2/bin/iotruntime/tomoyo/clear.tomoyo
16 echo "Master cleaned!"
18 # Clean the slave(s) and router
19 SLAVE1=""
20 ROUTER=""
21 RUNTIME_PATH="/home/iotuser/iot2/bin/iotruntime/"
22 echo "Cleaning slave!"
23 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/"
24 ssh iotuser@$SLAVE1 "cd $RUNTIME_PATH/slave/; rm -rf *.so; rm -rf *.zip; rm -rf *.log;"
25 echo "Slave benchmark files cleaned!"
26 ssh iotuser@$SLAVE1 "sudo iptables -F"
27 echo "Slave iptables cleaned!"
28 ssh iotuser@$SLAVE1 "sudo pkill -f IoTSlave"
29 echo "Slave processes killed!"
30 ssh iotuser@$SLAVE1 "sudo tomoyo-loadpolicy -df < $RUNTIME_PATH/tomoyo/clear.tomoyo"
31 echo "Slave process jailer cleaned!"
33 ssh root@$ROUTER "cd /root/setup; ./clean; ./"
34 echo "Router cleaned!"