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
|
#!/usr/bin/perl
die "Usage sendCmdToApp.pl host port cmdFile\n" if @ARGV != 3;
$host = $ARGV[0];
$port = $ARGV[1];
$cmdFile = $ARGV[2];
die "The file \"$cmdFile\" does not exist\n" unless -e $cmdFile;
$curlCmd = "curl --stderr /dev/null -H \"Content-Type: text/xml\" -H \"Content-Description: SOAP Message\" -H \"SOAPAction: urn:xdaq-application:lid=0\" http://$host:$port -d \@$cmdFile";
open CURL, "$curlCmd|";
print "Sending command to executive $host:$port ";
while(<CURL>) {
chomp;
$soapReply .= $_;
}
if($soapReply =~ m/Response/) {
print "OK\n";
exit 0;
} elsif($soapReply =~ m/Fault/) {
print "FAULT\n";
print "$soapReply\n";
exit 1;
} elsif($soapReply eq "") {
print "NONE\n";
exit 1;
} else {
print "UNKNOWN response\n";
print "$soapReply\n";
exit 1;
}
|