#!/usr/bin/env tclshexe
# Set the host and port of the LDAS manangerAPI
set hostName "ldas.ligo-wa.caltech.edu"
set port 10001
# Set the user command
set ldasCmd "ldasJob\
{-name myname -password blah -email me@ligo.caltech.edu}\
{getMetaData -returnprotocol http:out.xml -outputformat LIGO_LW\
-sqlquery {select tabname from syscat.tables} }"
# Open a socket to the LDAS managerAPI
if { [catch {socket $hostName $port} sockId] } {
puts "Unable to connect to LDAS manager"
exit
}
# Send the LDAS command
puts $sockId $ldasCmd
flush $sockId
# Get the response from the managerAPI and print it out
set jobInfo [read $sockId]
puts $jobInfo
# Close the socket connection and exit
close $sockId
exit
#!/usr/bin/env perl
# Set the host and port of the LDAS manangerAPI
$hostName = "ldas.ligo-wa.caltech.edu";
$port = 10001;
# Set the user command (note that the "@" is escaped)
$ldasCmd = "ldasJob"
. " {-name myname -password blah -email me\@ligo.caltech.edu}"
. " {getMetaData -returnprotocol http:out.xml -outputformat LIGO_LW"
. " -sqlquery {select tabname from syscat.tables} }";
# Open a socket to the LDAS managerAPI
use IO::Socket;
$sockId = IO::Socket::INET->new( Proto => "tcp",
PeerAddr => $hostName,
PeerPort => $port )
or die "Unable to connect to LDAS manager, aborting";
# Send the LDAS command
print $sockId $ldasCmd;
# Get the response from the managerAPI and print it out
@jobInfo = <$sockId>;
print @jobInfo;
# Close the socket connection and exit
close $sockId;
exit;
#include "DfSocket.h"
/*===========================================================================*/
int main(void)
{
char host[] = "ldas.ligo-wa.caltech.edu";
int port = 10001;
char command[] = "ldasJob {-name myname -password blah -email me@ligo.caltech.edu} {getMetaData -returnprotocol http:out.xml -outputformat LIGO_LW -sqlquery {select tabname from syscat.tables} }";
char buf[65536];
int status;
status = DfSocketCommand( host, port, command, buf, sizeof(buf) );
printf( "Status is %d\n", status );
printf( "Output is:\n%s\n", buf );
return status;
}
To compile this on Solaris, do:
gcc mycmd.c $LIGOTOOLS/lib/libdataflow.a -I$LIGOTOOLS/include -L/usr/lib -lsocket -lnsl -o mycmd
To compile it on Linux, do:
gcc mycmd.c $LIGOTOOLS/lib/libdataflow.a -I$LIGOTOOLS/include -o mycmd