* add loadbot control apps
This commit is contained in:
parent
7f8ea77986
commit
7f38244fde
|
@ -1 +1,3 @@
|
||||||
2011*
|
2011*
|
||||||
|
loadbot/do_all.sh
|
||||||
|
loadbot/testservers
|
||||||
|
|
4
Makefile
4
Makefile
|
@ -4,3 +4,7 @@ all:
|
||||||
mkdir $(DATESTAMP)
|
mkdir $(DATESTAMP)
|
||||||
inventory/inventory.sh $(DATESTAMP)
|
inventory/inventory.sh $(DATESTAMP)
|
||||||
cd cpu; make
|
cd cpu; make
|
||||||
|
|
||||||
|
prep:
|
||||||
|
cat loadbot/testservers |xargs -n 1 --replace=BLAH scp loadbot/prep.pl BLAH:
|
||||||
|
cat loadbot/testservers |xargs -n 1 --replace=BLAH ssh BLAH ./prep.pl
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
#!/bin/bash -x
|
||||||
|
|
||||||
|
#SELECT droplets.name, sizes.memory, vnics.vif as vname, ip_addresses.ip, images.name, servers.name from droplets
|
||||||
|
# JOIN sizes
|
||||||
|
# ON droplets.size_id = sizes.id
|
||||||
|
# JOIN vnics
|
||||||
|
# ON droplets.id = vnics.droplet_id
|
||||||
|
# JOIN ip_addresses
|
||||||
|
# ON vnics.ip_address_id = ip_addresses.id
|
||||||
|
# JOIN images
|
||||||
|
# ON droplets.image_id = images.id
|
||||||
|
# JOIN servers
|
||||||
|
# ON droplets.server_id = servers.id
|
||||||
|
# WHERE droplets.is_active=1;
|
||||||
|
|
||||||
|
# cat /tmp/junk |awk '{print $8}'
|
||||||
|
|
||||||
|
|
||||||
|
# run this once when you have a new collection of test servers
|
||||||
|
rm .ssh/known_hosts
|
||||||
|
cat testservers |xargs -n 1 --replace=BLAH echo ./ssh.pl BLAH root dopass \$1 > do_all.sh
|
||||||
|
bash -x do_all.sh "echo >> /etc/hosts"
|
||||||
|
bash -x do_all.sh "echo 69.55.54.144 loadbot >> /etc/hosts"
|
||||||
|
bash -x do_all.sh "restorecon -R /root/.ssh/"
|
||||||
|
|
||||||
|
echo "now copy prep.pl over to each server. this should be fast (no resolution delays)"
|
||||||
|
sleep 3
|
||||||
|
cat testservers |xargs -n 1 --replace=BLAH scp prep.pl BLAH:
|
||||||
|
|
||||||
|
echo "now run prep.pl"
|
||||||
|
sleep 3
|
||||||
|
cat testservers |xargs -n 1 --replace=BLAH ssh BLAH ./prep.pl
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
system "";
|
|
@ -0,0 +1,47 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
print "Running on " . `hostname`;
|
||||||
|
|
||||||
|
my $return = system("screen -list");
|
||||||
|
print "screen RETURN: $return\n";
|
||||||
|
|
||||||
|
if ($return eq "-1") {
|
||||||
|
if (-e "/etc/gentoo-release") {
|
||||||
|
system "emerge app-misc/screen";
|
||||||
|
} else {
|
||||||
|
system "yum install screen -y";
|
||||||
|
system "cat /etc/redhat-release";
|
||||||
|
}
|
||||||
|
system "ifconfig";
|
||||||
|
}
|
||||||
|
|
||||||
|
my $return = system("bc --version");
|
||||||
|
print "bc RETURN: $return\n";
|
||||||
|
|
||||||
|
if ($return eq "-1") {
|
||||||
|
if (-e "/etc/gentoo-release") {
|
||||||
|
system "emerge bc";
|
||||||
|
} elsif (-e "/etc/redhat-release") {
|
||||||
|
system "yum install bc -y";
|
||||||
|
} else {
|
||||||
|
system "apt-get install bc";
|
||||||
|
}
|
||||||
|
system "ifconfig";
|
||||||
|
}
|
||||||
|
|
||||||
|
my $return = system("git --version");
|
||||||
|
print "git RETURN: $return\n";
|
||||||
|
exit;
|
||||||
|
|
||||||
|
if ($return eq "-1") {
|
||||||
|
if (-e "/etc/gentoo-release") {
|
||||||
|
system "emerge git";
|
||||||
|
} elsif (-e "/etc/redhat-release") {
|
||||||
|
system "yum install git -y";
|
||||||
|
} else {
|
||||||
|
system "apt-get install git";
|
||||||
|
}
|
||||||
|
system "ifconfig";
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
#
|
||||||
|
# A Simple Terminal Resizing Example
|
||||||
|
# GPL version 2. See the COPYING file
|
||||||
|
#
|
||||||
|
# This script is a simple example of how handle terminal
|
||||||
|
# window resize events (transmitted via the WINCH signal)
|
||||||
|
# -- Jeff Carr <jcarr@linuxmachines.com>
|
||||||
|
#
|
||||||
|
|
||||||
|
if( ! defined $ARGV[0] ) {
|
||||||
|
print "Usage: ssh.pl host <username> <password>\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
my ($host, $username, $password, @commands) = @ARGV;
|
||||||
|
$username = $ENV{USER} if $username eq "";
|
||||||
|
|
||||||
|
use Expect;
|
||||||
|
use IO::Pty;
|
||||||
|
|
||||||
|
my $spawn = new Expect;
|
||||||
|
$spawn->raw_pty(1);
|
||||||
|
|
||||||
|
# This gets the size of your terminal window
|
||||||
|
$spawn->slave->clone_winsize_from(\*STDIN);
|
||||||
|
|
||||||
|
my $PROMPT;
|
||||||
|
|
||||||
|
# This function traps WINCH signals and passes them on
|
||||||
|
sub winch {
|
||||||
|
my $signame = shift;
|
||||||
|
my $pid = $spawn->pid;
|
||||||
|
$shucks++;
|
||||||
|
print "count $shucks,pid $pid, SIG$signame\n";
|
||||||
|
$spawn->slave->clone_winsize_from(\*STDIN);
|
||||||
|
kill WINCH => $spawn->pid if $spawn->pid;
|
||||||
|
}
|
||||||
|
$SIG{WINCH} = \&winch; # best strategy
|
||||||
|
|
||||||
|
$spawn=Expect->spawn("ssh $username\@$host \"@commands\"");
|
||||||
|
# log everything if you want
|
||||||
|
$spawn->log_file("/tmp/autossh.log.$$");
|
||||||
|
|
||||||
|
my $PROMPT = '[\]\$\>\#]\s$';
|
||||||
|
my $ret = $spawn->expect(15,
|
||||||
|
[ qr/\(yes\/no\)\?\s*$/ => sub { $spawn->send("yes\n"); exp_continue; } ],
|
||||||
|
[ qr/assword:\s*$/ => sub { $spawn->send("$password\n"); } ],
|
||||||
|
[ qr/ogin:\s*$/ => sub { $spawn->send("$username\n"); exp_continue; } ],
|
||||||
|
[ qr/REMOTE HOST IDEN/ => sub { print "FIX: .ssh/known_hosts\n"; exp_continue; } ],
|
||||||
|
[ qr/$PROMPT/ => sub { $spawn->send("echo Now try window resizing\n"); } ],
|
||||||
|
);
|
||||||
|
|
||||||
|
# Send a winch single on startup
|
||||||
|
winch();
|
||||||
|
|
||||||
|
# Hand over control
|
||||||
|
my $return = $spawn->interact();
|
||||||
|
print "ssh $host returned=$return\n";
|
||||||
|
sleep 1 if ! defined @commands;
|
||||||
|
exit;
|
Loading…
Reference in New Issue