[Swift-commit] r7646 - SwiftApps/cloud
ketan at ci.uchicago.edu
ketan at ci.uchicago.edu
Fri Mar 7 18:53:34 CST 2014
Author: ketan
Date: 2014-03-07 18:53:34 -0600 (Fri, 07 Mar 2014)
New Revision: 7646
Modified:
SwiftApps/cloud/rem
Log:
rem node testing
Modified: SwiftApps/cloud/rem
===================================================================
--- SwiftApps/cloud/rem 2014-03-08 00:04:31 UTC (rev 7645)
+++ SwiftApps/cloud/rem 2014-03-08 00:53:34 UTC (rev 7646)
@@ -1,4 +1,50 @@
-#!/usr/bin/env python
+#!/bin/bash
-# Add cloud resources to existing pool
+#set -x
+usage (){
+ printf "Usage: %s -a \"<space separated ip addresses in quotes>\" | -n <nodecount> \n" "${0}"
+}
+
+rem_instance() {
+ MACHINE=$1
+ #ec2din | grep 54.243.24.154 | awk '{print $2}'
+ instanceid=$(ec2din | grep $1 | awk '{print $2}')
+ ec2kill $instanceid
+ # Connect directly
+ return 0
+}
+
+rembyip (){
+ echo "$@"
+ for i in "$@" ; do
+ rem_instance $i
+ done
+}
+
+rembynum (){
+ #ec2-run-instance -k <key-name> -n 1 -g <groupname> --instance-type <type> <ami-id>
+ for i in $(seq 1 $1); do
+ ip=$(ec2din | grep running | head -1 | awk '{print $15}')
+ rem_instance "${ip}"
+ sleep 15
+ done
+}
+
+#use getopts to check user options
+while getopts ":a:n:" o ; do
+ case $o in
+ a)
+ rembyip ${OPTARG}
+ ;;
+
+ n)
+ rembynum ${OPTARG}
+ ;;
+
+ *)
+ usage
+ ;;
+ esac
+done
+
More information about the Swift-commit
mailing list