diff options
author | Raghavendra Bhat <raghavendrambk@gmail.com> | 2011-07-13 18:28:56 +0530 |
---|---|---|
committer | Raghavendra Bhat <raghavendrambk@gmail.com> | 2011-07-13 18:28:56 +0530 |
commit | bf87a7d06b054005040dad8dd7ac878210e8939f (patch) | |
tree | d502d224ccc1e4b851285d838c38975871f70c84 /python_pgms/cloud-on-fly/src/scripts/cloud_add.sh | |
parent | d8ba6881617e9abc01e0fa13bb7e88037fb35315 (diff) |
cloud seed
Diffstat (limited to 'python_pgms/cloud-on-fly/src/scripts/cloud_add.sh')
-rwxr-xr-x | python_pgms/cloud-on-fly/src/scripts/cloud_add.sh | 32 |
1 files changed, 32 insertions, 0 deletions
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 + |