Subversion Repositories wimsdev

Rev

Rev 3877 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3877 Rev 6807
Line 1... Line 1...
1
#! /bin/sh
1
#! /usr/bin/perl
-
 
2
use strict;
-
 
3
use IPC::Open3;
2
 
4
 
3
tmp=`echo "$wims_exec_parm" | ./bin/wrap..exec chemeq -n`
5
my $launcher = -f "../chroot/usr/local/bin/chemeq" ? "ch..root" : "wrap..exec";
4
echo "$tmp"
-
 
5
 
6
 
6
if echo "$tmp" | grep ERROR >/dev/null 2>&1; then
-
 
7
 today=`date '+%Y%m%d' 2>/dev/null`
-
 
8
 echo "$today chemeq: $wims_exec_parm" >>../log/user_error.log 2>/dev/null
7
my $wims_exec_parm = $ENV{'wims_exec_parm'};
9
fi
-
 
10
 
8
 
-
 
9
my $pid = open3(\*CHLD_IN, \*CHLD_OUT, \*CHLD_ERR, "bin/$launcher chemeq -n") or die "open3() failed $!";
-
 
10
 
-
 
11
print CHLD_IN "$wims_exec_parm\n";
-
 
12
close(CHLD_IN);
-
 
13
 
-
 
14
my $tmp ="";
-
 
15
while(<CHLD_OUT>){
-
 
16
    $tmp .= $_;
-
 
17
}
-
 
18
 
-
 
19
my $err = <CHLD_ERR>;
-
 
20
print $tmp;
-
 
21
 
-
 
22
 
-
 
23
if ($err =~ /ERROR/){
-
 
24
    my ($sec,$min,$hour,$day,$month,$yr19,@rest) =   localtime(time);
-
 
25
    my $d = sprintf qq{%04d/%02d/%02d-%02d:%02d:%02d},
-
 
26
      1900+$yr19, $month, $day, $hour, $min, $sec;
-
 
27
    print "Write to log:\n$d chemeq: $wims_exec_parm";
-
 
28
    my $log;
-
 
29
    open $log, ">>../log/user_error.log" or die $!;
-
 
30
    print $log "$d chemeq: $wims_exec_parm";
-
 
31
}