Hi All,
I am trying to connect the remote ssh server via ruby using
Net::SSH.It is working fine for me for all the commands provided via
script and i could able to read the output of the command successfully.
But when i use the below command it is getting stuck in SSH.exec!(cmd)
and control is not returned from the line. Only if i click Ctrl+c in
command line the script is getting ended.
The command is ./wcsadmin.sh start --> this is used to start the
processes of my application in remote server
Please find the below code snippet of my ruby script:
Net::SSH.start(host, username, :password => password) do |ssh|
puts 'before exit'
output = ssh.exec!(/opt/wcsadmin.sh start)
puts 'Executed command'
The output of the command when i do it manually is :
[root@test bin]# ./wcsadmin.sh start
Starting Network Control System…
This may take a few minutes…
stty: standard input: Invalid argument
Network Control System started successfully.
Starting SAM daemon…
Done.
Starting DA daemon…
Starting DA syslog daemon…
start
if i use ssh.exec(’./wcsadmin.sh start’) the only difference is the
above output is getting printed but still the program is never ended.I
need to manually end it by hitting ctrl+c.When i searched in google i
could find you can use nohup command('nohup /opt/wcsadmin.sh start
/tmp/teststartserver.log 2>&1’) to skip the hangup signals and tried
the same.This also writes the output to teststartserver.log but getting
hanged.Can anyone please help me out on this issue?
Thanks in Advance!
Thanks,
Meena