Monday, December 15, 2008

Perl code to initiate a shutdown from website

#!/app/perl5005/bin/perl -w

use lib "/Progra~1/Perl/site/lib";

use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
use vars qw($MP);

$| = 1; # unbuffer output

# Shutdown the Matrix Pricer first
$ua = LWP::UserAgent->new;
my $response = $ua->request(POST "http://localhost:8251/shutdown", [username => 'rdgadmin', confirm => 'yes']);

if(!$response->is_success)
{
        print STDERR "ERROR - could not shut down DMSwaps MatrixPricer\n";
}

# sleep for a minute so the PMT has no chance to restart it.
sleep(60);

exit(0);


No comments:

Post a Comment