Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Unable to ssh to a remote machine while calling the script through web

User771294-OracleMay 29 2015 — edited Jun 1 2015

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

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 29 2015
Added on May 29 2015
1 comment
1,150 views