summaryrefslogtreecommitdiff
path: root/sbhs_server/scan_rpis.sh
diff options
context:
space:
mode:
authordk-152017-06-18 16:22:48 +0530
committerdk-152017-06-18 16:22:48 +0530
commit0d491a1b346e4027863e584c2c70d036af1ae7af (patch)
treefb4bd04b18c2425429719026d297ac2f374ff22e /sbhs_server/scan_rpis.sh
parentcf83d814f61486a3ca3e1b9b73597b2e4fc124b7 (diff)
downloadSBHS-2018-Rpi-0d491a1b346e4027863e584c2c70d036af1ae7af.tar.gz
SBHS-2018-Rpi-0d491a1b346e4027863e584c2c70d036af1ae7af.tar.bz2
SBHS-2018-Rpi-0d491a1b346e4027863e584c2c70d036af1ae7af.zip
Add updated mailing system for master server
Diffstat (limited to 'sbhs_server/scan_rpis.sh')
-rw-r--r--sbhs_server/scan_rpis.sh16
1 files changed, 12 insertions, 4 deletions
diff --git a/sbhs_server/scan_rpis.sh b/sbhs_server/scan_rpis.sh
index 3a1fd3c..4577a41 100644
--- a/sbhs_server/scan_rpis.sh
+++ b/sbhs_server/scan_rpis.sh
@@ -1,11 +1,19 @@
#!/bin/bash
-mkdir -p temp
-nmap -n -sP 10.42.0.255/24 | grep -E -o "(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])" | grep -v "10.42.0.1" > temp/ipaddrs.txt
+cd sbhs_server
+mkdir -p RPi_data
+mkdir -p RPi_data/map RPi_data/report
+
+# get IP addresses of connected Raspberry Pi's
+nmap -n -sP 10.42.0.255/24 | grep -E -o "(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])" | grep -v "10.42.0.1" > RPi_data/ipaddrs.txt
+
+# Get map_machine_ids.txt and server reports from all connected Raspberry Pi's
while read -r ip
do
- curl -o temp/$ip.txt $ip/map_machine_ids.txt
-done < "temp/ipaddrs.txt"
+ curl -o RPi_data/map/$ip.txt $ip/map_machine_ids.txt
+ curl -o RPi_data/report/$ip.txt $ip/report.json
+done < "RPi_data/ipaddrs.txt"
+# Execute script to create IP map
python create_ip_map.py \ No newline at end of file