== Instruction == [https://geni-orca.renci.org/trac/wiki/velocity-templates Post-boot script] == Tutorial Experiment == === A Condor Cluster Request: 1 master node and 2 worker nodes === [[Image(Flukes-GREE13-1.png)]] ** PostBoot script at the Master Node {{{ "#!/bin/bash echo "hello from neuca script" echo StrictHostKeyChecking no >> /etc/ssh/ssh_config echo $CondorMaster.IP("Link1") condor-master condor-master.orca >> /etc/hosts for i in {100..200}; do name=$(($i - 100)) echo `echo $self.IP("Link1") | sed 's/.[0-9][0-9]*$//g'`.$i condor-w$name condor-w$name\.orca >> /etc/hosts done # echo condor-master > /etc/hostname /bin/hostname -F /etc/hostname /etc/init.d/condor stop cp /etc/condor/condor_config.master.local /etc/condor/condor_config.local echo 'CONDOR_HOST = condor-master.orca' >> /etc/condor/condor_config.local echo 'DEFAULT_DOMAIN_NAME = orca' >> /etc/condor/condor_config.local /etc/init.d/condor start #" }}} ** PostBoot Script at the worker node {{{ "#!/bin/bash function testSSH() { local user=${1} local host=${2} local timeout=${3} SSH_OPTS="-q -o PreferredAuthentications=publickey -o HostbasedAuthentication=no -o PasswordAuthentication=no -o StrictHostKeyChecking=no" ssh -q -q $SSH_OPTS -o "BatchMode=yes" -o "ConnectTimeout ${timeout}" ${user}@${host} "echo 2>&1" && return 0 || return 1 } echo "hello from neuca script" echo $CondorMaster.IP("Link1") condor-master condor-master.orca >> /etc/hosts for i in {100..200}; do name=$(($i - 100)) echo `echo $self.IP("Link1") | sed 's/.[0-9][0-9]*$//g'`.$i condor-w$name condor-w$name\.orca >> /etc/hosts done ip_end=`echo $self.IP("Link1") | sed 's/^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.//g'` name=$(($ip_end - 100)) host_name=condor-w$name echo $host_name > /etc/hostname /bin/hostname -F /etc/hostname # wait until the condor-master is pingable UNPINGABLE=true for ((i=0;i<60;i+=1)); do echo "testing ping, try: $i " >> /tmp/bootscript.out PING=`ping -c 3 condor-master > /dev/null 2>&1` if [ "$?" = "0" ]; then UNPINGABLE=false break fi sleep 10 done UNSSHABLE=true for ((i=0;i<60;i+=1)); do echo "testing ssh, try: $i" >> /tmp/bootscript.out testSSH root condor-master 5 if [ "$?" = "0" ]; then UNSSHABLE=false break fi sleep 10 done orca_name=$self.Name() echo $orca_name ssh condor-master "echo $orca_name > /tmp/$host_name" /etc/init.d/condor stop cp /etc/condor/condor_config.worker.local /etc/condor/condor_config.local echo 'CONDOR_HOST = condor-master.orca' >> /etc/condor/condor_config.local echo 'DEFAULT_DOMAIN_NAME = orca' >> /etc/condor/condor_config.local echo 'ALLOW_ADMINISTRATOR = *' >> /etc/condor/condor_config.local echo 'ALLOW_OWNER = *' >> /etc/condor/condor_config.local /etc/init.d/condor start" }}} ** Inside the Condor cluster: *** As root: {{{ 188 neuca-user-data 189 neuca-user-script 190 su - exogeni-user }}} ** *As exogeni-user: {{{ cd ExoGENI-demo/ 23 ls 24 ./ExoGENI-demo 5 25 less ExoGENI-demo.cmd 26 condor_status 27 condor_q 28 condor_submit ExoGENI-demo.cmd 29 condor_q 30 condor_status 31 condor_q 32 ls 33 cat ExoGENI-demo.out 34 condor_submit ExoGENI-demo.cmd 35 condor_q 36 watch condor_q }}} === Add and Remove nodes === [[Image(Flukes-GREE13-2.png)]]