From: <sco...@us...> - 2013-02-01 20:07:39
|
Revision: 25280 http://gmod.svn.sourceforge.net/gmod/?rev=25280&view=rev Author: scottcain Date: 2013-02-01 20:07:28 +0000 (Fri, 01 Feb 2013) Log Message: ----------- Script to "call home" on a GMOD in the Cloud instance; works on Ubuntu 10.04. It's an open question as to whether it will work on 12.04. Added Paths: ----------- schema/trunk/chado/bin/GMODCallHome.pl Added: schema/trunk/chado/bin/GMODCallHome.pl =================================================================== --- schema/trunk/chado/bin/GMODCallHome.pl (rev 0) +++ schema/trunk/chado/bin/GMODCallHome.pl 2013-02-01 20:07:28 UTC (rev 25280) @@ -0,0 +1,47 @@ +#!/usr/bin/perl +use strict; +use warnings; +use VM::EC2; +use HTTP::Request::Common; +use LWP::UserAgent; +use FindBin '$Bin'; +use constant REGISTRATION_SERVER + => 'http://modencode.oicr.on.ca/cgi-bin/gbrowse_registration'; + + +my $instance = VM::EC2->instance_metadata(); # should be a metadata object + +my $userdata = $instance->userData; +my %userdata = map {split /\s*\:\s*/, $_ } split "\n", $userdata; + +#check to see if this instance all ready called +exit 0 if (-f "$Bin/gitc_lock"); + +#check if user specifically doesn't want to call home +#exit 0 if ($userdata{'NoCallHome'}); + +my $ipaddress = $instance->publicIpv4; + +my @callhome = ( user => "GMOD in the Cloud:".$instance->imageId.'|'.$instance->instanceType, + email => $userdata{email} || '', + org => $userdata{org} || '', + organism => $userdata{organism} || '', + site => $ipaddress + ); + +print @callhome; + +my $ua = LWP::UserAgent->new; +my $response = $ua->request( + POST(REGISTRATION_SERVER, + \@callhome + )); + +#to prevent the same instance from calling home more than once +open (LOCK, ">$Bin/gitc_lock"); +print LOCK "Sending the 'call home' email. If you would like to suppress this in the\nfuture, add 'NoCallHome : 1' to the userdata when launching the instance.\n"; + +close LOCK; + +exit 0; + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sco...@us...> - 2013-02-01 21:04:51
|
Revision: 25281 http://gmod.svn.sourceforge.net/gmod/?rev=25281&view=rev Author: scottcain Date: 2013-02-01 21:04:39 +0000 (Fri, 01 Feb 2013) Log Message: ----------- adding back the check to keep the script from running if the owner specifically requests it not run with userdata NoCallHome:1 Modified Paths: -------------- schema/trunk/chado/bin/GMODCallHome.pl Modified: schema/trunk/chado/bin/GMODCallHome.pl =================================================================== --- schema/trunk/chado/bin/GMODCallHome.pl 2013-02-01 20:07:28 UTC (rev 25280) +++ schema/trunk/chado/bin/GMODCallHome.pl 2013-02-01 21:04:39 UTC (rev 25281) @@ -18,7 +18,7 @@ exit 0 if (-f "$Bin/gitc_lock"); #check if user specifically doesn't want to call home -#exit 0 if ($userdata{'NoCallHome'}); +exit 0 if ($userdata{'NoCallHome'}); my $ipaddress = $instance->publicIpv4; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |