I have a Linux machine where I have created a cgi script (JarPatch.cgi), the code of which looks like this:
#!/usr/bin/perl
use warnings;
print "Content-type: text/html\n\n";
system ("sh JarPatch.sh");
The code of JarPatch.sh looks like this:
#!/bin/bash
echo "Inside jar patching tool";
PJS_DEV=app4915@slcai833.us.oracle.com;
ssh -f $PJS_DEV "cd /slot/ems4915/appmgr/tmp; echo stopping server ; ./find_stop_servers.sh;"
echo "Exit jar patching tool";
This script will basically shut down a server running on the remote machine
Problem statement is this: When I execute this cgi script through Linux terminal, I can see that the ssh commands are getting executed and as a result server is shut down.
When I access the cgi script through a browser, the shell script is invoked but ssh seems not to be working.
Can any one give me a pointer to resolve this issue please? I am new to perl/shell integration. So might be missing something small as well. Thanks