[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Condor-users] useful script for dynamic hostnames

hi everybody,

We are using a condor pool of windows and linux boxes with the central manager on a linux server.

Our windows condor machines are getting a dynamic hostnames given by the dns that looks like blockXXX-YYY.dhcp.mydomain.com. I have no control over the DNS.

The problem is that the condor master does not know about this dynamic hostname but uses instead the computer name given to the machine : machine-lambda. (which is also used to connect to a windows domain)

This prevented me from using the condor commands with the -name parameter.

To solve the problem, I have written a bash script (see below) that I run periodically (crontab) on the central manager that gets the names and ips of all the condor master running and updates the /etc/hosts with the computer name, default domain name and ip.

Now I can use commands such as "condor_q -name machine-lambda" on the central manager and can also directly connect to any linux box by ssh-ing machine-lambda.mydomain.com without having to look up its ip address.

Hope this can be useful



/usr/local/bin/condor_status -master -format "%.30s " Name \
     -format "%s\n" MasterIpAddr > /tmp/condor-addresses

while read hostname address
   host=`echo $hostname | awk -F"."  '{print $1}'`
      address=`echo $address| awk -F"<"  '{print $2}'| \
        awk -F":" '{print $1}'`
 if [ -n "$address" ]
   echo "$address $hostname $host" >> /etc/hosts
done < /tmp/condor-addresses
rm /tmp/condor-addresses


 Olivier RICHE, Computing officer
 University of Ulster, School of Biomedical Sciences,
 Systems Biology Research group
 Cromore Road, Coleraine BT52 1SA, Northern Ireland
 phone: +44-(0)28-70-323205
 fax: +44 (0)28-70-324375
 email: o.riche@xxxxxxxxxxxx