Operating System - HP-UX
1753784 Members
7100 Online
108799 Solutions
New Discussion

How to send output during ssh command execution

 
SwissKnife
Frequent Advisor

How to send output during ssh command execution

Hi,

 

Here is a ksh function:

 

function GenSnapshot {

spout=`ssh -T -i ~/.ssh/delphix_key cs.delphix.ds@dlx37cti1 <<- EOF
    database
    select ${DELPHIX_OBJECT}
    sync
    commit
    exit
EOF`

}

 

I'm not mastering execution time an this is normal (Sometime it tooks few seconds, sometime few hours). How to encapsulate the ssh call to provide an output every X minutes saying something like "Executing...."

Thanks in advance,

Best regards, Den.

 

1 REPLY 1
Dennis Handly
Acclaimed Contributor

Re: How to send output during ssh command execution

You could put it in the background and then every N seconds check to see if the process is still alive.

And when done, copy the redirected output to the screen.

$! is the process of the last background command.  Use "kill -0 $PID" to check if alive.