This commit was generated by cvs2svn to compensate for changes in r45,
[pingofdeath.git] / pl-podset
diff --git a/pl-podset b/pl-podset
new file mode 100755 (executable)
index 0000000..4d69d32
--- /dev/null
+++ b/pl-podset
@@ -0,0 +1,46 @@
+#! /bin/bash
+Invocation="pl-podset HOSTIPAddr TARGETIPAddr"
+# Run on a controlling computer to set the pod parameters on a
+# remote node.  A hash code is generated and set into the remote
+# node and stored in a local file for later invocation.
+# -----------------------------------------------------------------
+# $Header: /shareddata/CVS/planetlab/admin/ipod/pl-podset,v 1.3 2003/01/18 01:43:48 radams Exp $
+#
+# Copyright (c) 2003 Intel Corporation
+# All rights reserved.
+# This file is distributed under the terms in the attached INTEL_LICENSE
+# file.  If you do not find this file, a copy can be obtained by
+# writing to Intel Research Berkeley; Attention: Intel License Inquiry;
+# 2150 Shattuck Avenue; Berkeley, CA 94704
+# -----------------------------------------------------------------
+
+HOSTIP=$1
+TARGETIP=$2
+
+if [[ x$HOSTIP == x || x$TARGETIP == x ]] ; then
+    echo "Invocation: $Invocation"
+    exit 1
+fi
+
+DATEE=`date +%Y%m%d%H%M`
+TEMPFILE="/tmp/HashFile_$RANDOM"
+HASHFILE="./HashFile"
+PLBIN="/usr/local/planetlab/bin"
+
+HASHCODE=`printf "%04x%04x%04x%04x%04x%04x%04x%04x\n" $RANDOM $RANDOM $RANDOM $RANDOM $RANDOM $RANDOM $RANDOM $RANDOM`
+
+#echo "HOSTIP = $HOSTIP"
+#echo "TARGETIP = $TARGETIP"
+#echo "HASHCODE = '$HASHCODE'"
+
+ssh idsl1@$TARGETIP "sudo $PLBIN/pl-podcntl $HOSTIP 255.255.255.255 $HASHCODE"
+
+if [[ -f $HASHFILE ]] ; then
+    grep -v "$TARGETIP" $HASHFILE > $TEMPFILE
+else
+    touch $HASHFILE
+    touch $TEMPFILE
+fi
+echo "$DATEE    $HOSTIP $TARGETIP   $HASHCODE" >> $TEMPFILE
+mv $HASHFILE $HASHFILE.last
+mv $TEMPFILE $HASHFILE