#!/bin/sh
# to make this file executable on linux, use
# chmod a+x <this script>
# http://www.askdavetaylor.com/how_do_i_read_lines_of_data_in_a_shell_script.html
while read inputline
do
# skip lines with a !
char1="$(echo $inputline | cut -d" " -f1)"
# note: "!" isn't a good line-commenter for linux
if [ $char1 = "::" ]
then
.
# Do nothing: skip line
else
boxname="$(echo $inputline | cut -d" " -f1)"
passwrd="$(echo $inputline | cut -d" " -f2)"
#echo "computer is named $boxname"
#echo "and password is $passwrd"
# ensure the node is reachable first, otherwise skip
# ping
# create a local directory to mount the node shares
mkdir local_share
# mount the remote nodes
sudo mount -t cifs //$boxname/c$ local_share/ -o rw,username=$boxname\/physics,password=$passwrd
# copy everything in the directory that contains the scripts, input files, windows executable
cp -r ../for_remote_node/ local_share
# when file transfer is complete, unmount the node share
sudo umount local_share/
# call the script that starts the executable
./winexe-static-081123 -U $boxname/physics%$passwrd //$boxname 'cmd /c c:\research_dump1\runner.cmd'
fi
done < ../nodes_single.txt
exit 0