LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-02-2012, 02:17 AM   #1
say_hi_ravi
Member
 
Registered: Jan 2008
Posts: 70

Rep: Reputation: 15
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
 
Old 09-02-2012, 10:11 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 18,886

Rep: Reputation: 4258Reputation: 4258Reputation: 4258Reputation: 4258Reputation: 4258Reputation: 4258Reputation: 4258Reputation: 4258Reputation: 4258Reputation: 4258Reputation: 4258
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.
 
Old 09-03-2012, 10:00 PM   #3
say_hi_ravi
Member
 
Registered: Jan 2008
Posts: 70

Original Poster
Rep: Reputation: 15
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
 
Old 09-04-2012, 01:20 PM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 18,886

Rep: Reputation: 4258Reputation: 4258Reputation: 4258Reputation: 4258Reputation: 4258Reputation: 4258Reputation: 4258Reputation: 4258Reputation: 4258Reputation: 4258Reputation: 4258
Quote:
Originally Posted by say_hi_ravi View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
(BASH) Works on the command line, hangs as a script -- what's wrong? SilversleevesX Programming 17 08-08-2010 10:19 PM
[SOLVED] exit in script files cause konsole terminal itself to exit Star_Gazer Programming 11 04-12-2010 08:32 AM
I am unable to exit my script that uses ssh to login to a remote server jtbinuya Linux - Newbie 2 06-12-2008 10:17 PM
Mac OS X ssh client / linux sshd : ssh hangs/disconnects Apollo77 Linux - Networking 1 05-24-2006 11:53 AM
A C-shell script doesn't work on redhat 7.3 but works on Sun Solaris Belmer Linux - Newbie 2 02-08-2004 11:05 AM


All times are GMT -5. The time now is 04:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration