view scripts/paxos.pl @ 182:1559aa74dc74

add paxos sh
author akahori
date Sat, 02 Feb 2019 15:18:17 +0900
parents
children
line wrap: on
line source

#!usr/bin/perl

my $debug = 0;

sub mysystem {
  my ($cmd) = @_;
  if ($debug) {
    print $cmd ,"\n";
  } else {
    system $cmd;
  }
}

ruby ./paxos.rb $1 $2 $3 > Log/paxos.dot

my $nodes = $ENV{'PBS_NODEFILE'};
my $java11binPath = "/mnt/data/christie_workspace/jdk-11.0.1/bin/";
my $christieDir = "/mnt/data/christie_workspace/";
my $dotFile = "${christieDir}scripts/Log/paxos.dot"
my $logFile = "${christieDir}Log/";
my $logNum  = "0000";

open my $fd,"<",$nodes or die("can't read file $nodes $!");

while (<$fd>) {
  chop ;
  unshift(@nodes,$_);
}

mysystem("ssh $nodes[0] \"cd $christieDir;${java11binPath}java -cp Christie.jar christie.topology.manager.StartTopologyManager --localPort 10000 --confFile ${dotFile} > $logFile$logNum\" &");

$logNum++;
for my $i (1..($#nodes)) {
  print "nodes[i]: $i $nodes[$i]\n";
  mysystem("ssh $nodes[$i] \"cd $christieDir;${java11binPath}java -cp Christie.jar christie.test.topology.paxos.StartPaxosNode --localPort 10000 --managerHost $nodes[0] --managerPort 10000 > $logFile$logNum\" &");
  $logNum++;
}