Changes between Initial Version and Version 1 of PostbootTutorial


Ignore:
Timestamp:
03/18/13 16:41:31 (11 years ago)
Author:
yxin@renci.org
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PostbootTutorial

    v1 v1  
     1== Instruction ==
     2[https://geni-orca.renci.org/trac/wiki/velocity-templates Post-boot script]
     3
     4== Tutorial Experiment ==
     5=== A Condor Cluster Request: 1 master node and 2 worker nodes ===
     6
     7[[Image(Flukes-GREE13-1.png)]]
     8
     9** PostBoot script at the Master Node
     10
     11{{{
     12"#!/bin/bash
     13
     14echo "hello from neuca script"
     15echo  StrictHostKeyChecking no >> /etc/ssh/ssh_config
     16
     17echo $CondorMaster.IP("Link1")  condor-master condor-master.orca >> /etc/hosts
     18for i in {100..200}; do
     19   name=$(($i - 100))
     20   echo `echo $self.IP("Link1") | sed 's/.[0-9][0-9]*$//g'`.$i  condor-w$name condor-w$name\.orca >> /etc/hosts
     21done
     22#
     23echo condor-master > /etc/hostname
     24/bin/hostname -F /etc/hostname
     25/etc/init.d/condor stop
     26cp /etc/condor/condor_config.master.local /etc/condor/condor_config.local
     27echo 'CONDOR_HOST     = condor-master.orca' >> /etc/condor/condor_config.local
     28echo 'DEFAULT_DOMAIN_NAME = orca' >> /etc/condor/condor_config.local
     29/etc/init.d/condor start
     30#"
     31}}}
     32
     33** PostBoot Script at the worker node
     34
     35{{{
     36"#!/bin/bash
     37
     38function testSSH() {
     39        local user=${1}
     40        local host=${2}
     41        local timeout=${3}
     42       
     43        SSH_OPTS="-q -o PreferredAuthentications=publickey -o HostbasedAuthentication=no -o PasswordAuthentication=no -o StrictHostKeyChecking=no"
     44       
     45        ssh -q -q $SSH_OPTS -o "BatchMode=yes" -o "ConnectTimeout ${timeout}"  ${user}@${host} "echo 2>&1" && return 0 || return 1
     46}
     47
     48
     49
     50echo "hello from neuca script"
     51
     52echo $CondorMaster.IP("Link1")  condor-master condor-master.orca >> /etc/hosts
     53for i in {100..200}; do
     54   name=$(($i - 100))
     55   echo `echo $self.IP("Link1") | sed 's/.[0-9][0-9]*$//g'`.$i  condor-w$name  condor-w$name\.orca >> /etc/hosts
     56done
     57ip_end=`echo $self.IP("Link1") |  sed 's/^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.//g'`
     58name=$(($ip_end - 100))
     59host_name=condor-w$name
     60echo $host_name  > /etc/hostname
     61/bin/hostname -F /etc/hostname
     62
     63# wait until the condor-master is pingable
     64UNPINGABLE=true
     65for ((i=0;i<60;i+=1));
     66do
     67      echo "testing ping, try: $i " >> /tmp/bootscript.out
     68      PING=`ping -c 3 condor-master > /dev/null 2>&1`
     69      if [ "$?" = "0" ]; then
     70           UNPINGABLE=false
     71           break
     72       fi
     73       sleep 10
     74done
     75
     76UNSSHABLE=true
     77for ((i=0;i<60;i+=1));
     78do
     79   echo "testing ssh, try: $i" >> /tmp/bootscript.out
     80   testSSH root condor-master 5
     81   if [ "$?" = "0" ]; then
     82        UNSSHABLE=false
     83        break
     84    fi
     85    sleep 10
     86 done
     87
     88orca_name=$self.Name()
     89echo $orca_name
     90
     91ssh condor-master "echo $orca_name > /tmp/$host_name"
     92
     93/etc/init.d/condor stop
     94cp /etc/condor/condor_config.worker.local /etc/condor/condor_config.local
     95echo 'CONDOR_HOST     = condor-master.orca' >> /etc/condor/condor_config.local
     96echo 'DEFAULT_DOMAIN_NAME = orca' >> /etc/condor/condor_config.local
     97echo 'ALLOW_ADMINISTRATOR = *' >> /etc/condor/condor_config.local
     98echo 'ALLOW_OWNER = *' >> /etc/condor/condor_config.local
     99/etc/init.d/condor start"
     100}}}
     101
     102** Inside the Condor cluster:
     103
     104*** As root:
     105
     106{{{
     107  188  neuca-user-data
     108  189  neuca-user-script
     109  190  su  exogeni-user
     110}}}
     111
     112** *As exogeni-user:
     113
     114 {{{
     115cd ExoGENI-demo/
     116   23  ls
     117   24  ./ExoGENI-demo 5
     118   25  less ExoGENI-demo.cmd
     119   26  condor_status
     120   27  condor_q
     121   28  condor_submit ExoGENI-demo.cmd
     122   29  condor_q
     123   30  condor_status
     124   31  condor_q
     125   32  ls
     126   33  cat ExoGENI-demo.out
     127   34  condor_submit ExoGENI-demo.cmd
     128   35  condor_q
     129   36  watch condor_q
     130}}}
     131
     132=== Add and Remove nodes ===
     133[[Image(Flukes-GREE13-2.png)]]