From bf87a7d06b054005040dad8dd7ac878210e8939f Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Wed, 13 Jul 2011 18:28:56 +0530 Subject: cloud seed --- python_pgms/cloud-on-fly/src/scripts/cloud_add.sh | 32 +++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 python_pgms/cloud-on-fly/src/scripts/cloud_add.sh (limited to 'python_pgms/cloud-on-fly/src/scripts/cloud_add.sh') diff --git a/python_pgms/cloud-on-fly/src/scripts/cloud_add.sh b/python_pgms/cloud-on-fly/src/scripts/cloud_add.sh new file mode 100755 index 0000000..8254d0b --- /dev/null +++ b/python_pgms/cloud-on-fly/src/scripts/cloud_add.sh @@ -0,0 +1,32 @@ +#Simple script to aws add machines cloud table +#AWS_file.txt -- shoud have list of machine names like, ec2-67-202-6-25.compute-1.amazonaws.com +#Note : For NFS- First client_pool table record will acts as NFS server. + +if [ ! $# -eq 2 ] + then + echo "Usage:cloud_add.sh [server/client] AWS_file.txt" + exit + fi + +table=$1_pool +file=$2 +dbpath="/usr/share/cloud/cloud_db.sqlite" + +for sys in `cat $file` +do + +part1=`echo $sys | cut -f1 -d'.' | cut -d'-' -f2` +part2=`echo $sys | cut -f1 -d'.' | cut -d'-' -f3` +part3=`echo $sys | cut -f1 -d'.' | cut -d'-' -f4` +part4=`echo $sys | cut -f1 -d'.' | cut -d'-' -f5` + +ipaddr=$part1"."$part2"."$part3"."$part4 + +qry="insert into $table values (\"$sys\",\"free\",\"$ipaddr\");" +echo "Running Query:" $qry + +sqlite3 $dbpath << EOF +$qry +EOF +done + -- cgit