C
CAT
I wrote a simple perl scripts to run a scripts remotely in another
machine and copy the result back to local server and show it on the
web browser. It will only work on command line (Will show nothing on
browser ) if I defined "APP_ROOT=/opt/APP/server/app" in the remote
scripts.
If I remove this line, it just works fine. (show the result fast on my
IE or Firefox browser)
APP_ROOT is required for me. Then I unset it by put "UnsetEnv
APP_ROOT" in my httpd.conf, however, it still refuses to work.
Please help.
root@localbox# cat showremote.cgi
#!/usr/bin/perl
##
## printedi -- CGI program which just prints app check information
##
print "Content-type: text/plain\n\n";
#This line generates check file
system ("ssh 10.1.1.10 /export/home/admin/check.sh");
#This line copy the file over to localbox
system ("scp 10.1.1.10:/tmp/check.txt /tmp");
# Name the file
$file1 = '/tmp/check.txt';
print scalar(localtime);
open(INFO1, $file1); # Open the file
@lines1 = <INFO1>; # Read it into an array
close(INFO1); # Close the file
print @lines1;
system (`/usr/bin/rm /tmp/check.txt`);
root@remotebox# cat check.sh
#!/usr/bin/ksh
APP_ROOT=/opt/APP/server/app
export APP_ROOT
TODAY=`date`
echo $TODAY > /tmp/check.txt
echo ""
/opt/APP/server/app /bin/app status | grep NOT-RUNNING >> /tmp/
check.txt
machine and copy the result back to local server and show it on the
web browser. It will only work on command line (Will show nothing on
browser ) if I defined "APP_ROOT=/opt/APP/server/app" in the remote
scripts.
If I remove this line, it just works fine. (show the result fast on my
IE or Firefox browser)
APP_ROOT is required for me. Then I unset it by put "UnsetEnv
APP_ROOT" in my httpd.conf, however, it still refuses to work.
Please help.
root@localbox# cat showremote.cgi
#!/usr/bin/perl
##
## printedi -- CGI program which just prints app check information
##
print "Content-type: text/plain\n\n";
#This line generates check file
system ("ssh 10.1.1.10 /export/home/admin/check.sh");
#This line copy the file over to localbox
system ("scp 10.1.1.10:/tmp/check.txt /tmp");
# Name the file
$file1 = '/tmp/check.txt';
print scalar(localtime);
open(INFO1, $file1); # Open the file
@lines1 = <INFO1>; # Read it into an array
close(INFO1); # Close the file
print @lines1;
system (`/usr/bin/rm /tmp/check.txt`);
root@remotebox# cat check.sh
#!/usr/bin/ksh
APP_ROOT=/opt/APP/server/app
export APP_ROOT
TODAY=`date`
echo $TODAY > /tmp/check.txt
echo ""
/opt/APP/server/app /bin/app status | grep NOT-RUNNING >> /tmp/
check.txt