LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   SSH script hangs on exit on solaris but linux works (https://www.linuxquestions.org/questions/linux-newbie-8/ssh-script-hangs-on-exit-on-solaris-but-linux-works-4175425228/)

say_hi_ravi 09-02-2012 02:17 AM

SSH script hangs on exit on solaris but linux works
 
Hello,

I am doing below steps:
1. Copying one script to remote server using SSH.
2. executing that script using SSH.

Below is the command:

Quote:

#scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ConnectTimeout=10 /home/ravmane/sysmgmt/sentinel_scripts/unix_su_root.sh testserver1:/tmp/;ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ConnectTimeout=10 testserver1 "/tmp/unix_su_root.sh"
On Linux server the script executes and exit from the remote server properly.

But on Solaris it executes the script but does not exit. We have to make it manually exit using ^C.

I want to run it on many Solaris servers.

The script last lines are below:

Quote:

/etc/init.d/service-rem start

sleep 5

ps -edf | grep rem
Any help/hint would be much appreciated.

Thanks,
Ravi

TB0ne 09-02-2012 10:11 AM

Well, unless you show us the script, we're not going to be able to tell you ANYTHING about why it's failing. The lines you've provided can't tell us anything outside of the context of the rest of the script.

say_hi_ravi 09-03-2012 10:00 PM

HI,

Below is the script.

Quote:

#!/bin/bash

sed 's/su mdscout/su root/g' /etc/init.d/solscout > /tmp/solscout.new && mv /tmp/solscout.new /etc/init.d/solscout

chmod +x /etc/init.d/solscout

/etc/init.d/solscout stop

sleep 5

RESULT=`pgrep solscout`

if [ -z "$RESULT" ]; then
echo "Scout not running"
else
echo "Scout running, attempting to kill"
pkill -KILL solscout
fi

/etc/init.d/solscout start

sleep 5

ps -edf | grep scout

TB0ne 09-04-2012 01:20 PM

Quote:

Originally Posted by say_hi_ravi (Post 4771974)
HI,
Below is the script.

No, it isn't. The lines you provided in your first post don't match anything in the script of the second. Best way to diagnose it is to run each command in the script, line by line, from a terminal window. See what the commands do. Also, you say it's not exiting...but you don't have an exit in there anywhere.


All times are GMT -5. The time now is 02:53 AM.