#!/bin/bash

# find ip
IP_ADDR=$(ip addr show | grep "inet " | grep  "eth0" | awk '{print $2}')


# find all clients connected to network
nmap -sP $IP_ADDR  | grep ondemand_mpi_worker | awk  -F "[()]" '{ for (i=2; i<NF; i+=2) print $i }' > /project/hosts