2 # This is an executer script that is launched remotely.
3 # It reads the job.xml file and acts as a launcher to
4 # execute different jobs remotely one by one.
6 # The script accepts commandline arguments
7 # job-exe "username" "password"
12 require 'rubyscript2exe'
14 # sensitive information
18 # paths to job and cluster xml files
19 job_file_path = "./job.xml"
21 # Parse job and cluster xml file with xmlsimple library
22 puts "Parsing the job xml file"
23 job_file = XmlSimple.xml_in( job_file_path, { 'KeyAttr' => 'name' })
25 # Now that we have the all the machine addresses
26 # loop through the job.xml for jobs to process and start them
33 p job_file['server'][0]
34 if job_file['server'][counter] then
35 machine << job_file['server'][counter]
42 machine.each do |host|
43 # put all the commands in array ~ command
44 job_file['server'][host]['command'].each do |x|
49 Net::SSH.start( host, username, :password => password) do |ssh|
50 # execute command to host
53 puts "Execution of command #{c} on #{host} has started!"
56 puts "No more jobs for #{host}"