plabhttpd.in 1.24 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2003 University of Utah and the Flux Group.
# All rights reserved.
#

#
# Simple little script to start up thttpd on planetlab nodes - it actually
# restarts the server gracefully, so that any downloads already going on will
# get to complete
#
# NOTE: This script currently requires YOUR keys, because it logs in as utah1
# on the planetlab nodes
#

use lib '@prefix@/lib';
use libdb;

#
# Username that we'll use to ssh into planetlab nodes
#
my $PLAB_USER = "utah1";

#
# Script to run on the plab nodes to start the webserver
#
my $THTTPD_START = "netbed_files/sbin/thttpd.restart";

#
# SSH command
#
my $SSH = "ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no -l $PLAB_USER";

#
# Get a list of planetlab nodes that are up
#
my $query_result = DBQueryFatal("SELECT n.node_id FROM nodes as n " .
            "LEFT JOIN node_status AS s ON n.node_id=s.node_id " .
	    "LEFT JOIN reserved AS r ON n.node_id = r.node_id " .
	    "WHERE n.type=\"pcplabphys\" AND s.status=\"up\" AND " .
		"!(r.pid=\"" . NODEDEAD_PID .
		    "\" AND r.eid=\"" . NODEDEAD_EID .  "\")");

while (my ($node) = $query_result->fetchrow()) {
    print "Starting up webserver on $node ...\n";
    system "$SSH $node $THTTPD_START";
}