Friday, August 21, 2009

Poor Man's Cluster - Step 9

This is going to be my last entry to this topic. I'll be making new topics for the 2009-2010 school year. Anyway, I thought you'd be interested in a couple scripts we used from time to time. These are not entirely necessary, but proved helpful:

biscuit.sh:
./povray +i./scenes/advanced/biscuit.pov -f +d +p +v +w1024 +h768 +a0.1 +L./include

addkey.sh:
#ssh root@10.5.129.$1 "useradd -m cluster && passwd cluster"
#ssh cluster@10.5.129.$1 "mkdir -p /home/cluster/.ssh;echo 1; ssh-keygen -N \"\" -f /home/cluster/.ssh/id_rsa -t rsa;echo 2;"
#scp -v cluster@10.5.129.$1:/home/cluster/.ssh/id_rsa.pub cluster@10.5.129.7:/home/cluster/id_rsa.pub$1;echo 3;
for ((a=1;a<26;a++));do echo trying $a; ssh -x cluster@10.5.129.$a "ssh-keygen -N \"\" -f /home/cluster/.ssh/id_rsa" ; scp cluster@10.5.129.$a:/home/cluster/.ssh/id_rsa.pub /home/cluster/id_rsa.pub$a ;done
#ssh -x cluster@10.5.129.$1 "mkdir -p /home/cluster/.ssh; ssh-keygen -N \"\" -f /home/cluster/.ssh/id_rsa -t rsa; scp /home/cluster/.ssh/id_rsa.pub cluster@10.5.129.7:/home/cluster/id_rsa.pub$1"

populate.sh:
for ((i=1;i<26;i++));do scp .ssh/authorized_keys 10.5.129.$i:/home/cluster/.ssh; scp .ssh/known_hosts 10.5.129.$i:/home/cluster/.ssh; scp .vimrc 10.5.129.$i:/home/cluster; ssh 10.5.129.$i ln .ssh/authorized_keys .ssh/authorized_keys2; echo done $i; done

povkill.sh:
#!/bin/bash
for a in $@; do
addr="10.5.129."${a#10.5.129.}
addr=${addr/10.5.129.self/127.0.0.1}
addr=${addr/10.5.129.localhost/127.0.0.1}
addr=${addr/10.5.129.127.0.0.1/127.0.0.1}
ssh cluster@$addr pkill -u cluster povray
echo $a done
done

shutdown.sh:
for a in $@; do
ssh root@10.5.129.$a reboot
done

Enjoy,
A. Jorge Garcia,
calcpage@aol.com,
http://calcpage.tripod.com/,
http://www.zazzle.com/cistheta2008,
http://cistheta2007.deviantart.com/,
http://www.youtube.com/cistheta2007

No comments:

Post a Comment