LinuxQuestions.org
Review your favorite Linux distribution.
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 05-19-2013, 04:24 AM   #1
Kenny83
LQ Newbie
 
Registered: Dec 2011
Posts: 4

Rep: Reputation: Disabled
Can't remote run the scripts through SSH


I have two machine A and B.
Both machines run on the Redhat Enterprise 5.8.
I have a script named test.sh on the machine B.
The directory of the script is /root/Desktop/test.sh.
The script contain a while loop to listen the serial port message.
I need to use machine A to execute the scripts on the machine B using root account.
Thus, I use the command [ssh machineB /root/Desktop/test.sh].
The script hangs on the machine A because of the while loop.
Thus, I use the command [ssh machineB /root/Desktop/test.sh &].
However, the process appears on the machine A.
How to solve it?
 
Old 05-19-2013, 04:45 AM   #2
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,415

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
Show us what you have written in the script.
 
Old 05-19-2013, 07:50 AM   #3
Habitual
LQ Addict
 
Registered: Jan 2011
Posts: 8,245
Blog Entries: 11

Rep: Reputation: 2287Reputation: 2287Reputation: 2287Reputation: 2287Reputation: 2287Reputation: 2287Reputation: 2287Reputation: 2287Reputation: 2287Reputation: 2287Reputation: 2287
Quote:
Originally Posted by Kenny83 View Post
The script hangs on the machine A because of the while loop.
Can you please explain this statement and how you came to make that determination?
 
Old 05-19-2013, 01:41 PM   #4
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,363

Rep: Reputation: 135Reputation: 135
Quote:
Originally Posted by Kenny83 View Post
How to solve it?
First try to debug the script in localhost with login to
Code:
root@localhost
.

Run the script with
Code:
set -xv
on. Then find at which step your script hangs. If you can post the script, that would be easier to help.
 
Old 05-19-2013, 01:51 PM   #5
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian
Posts: 2,159

Rep: Reputation: 334Reputation: 334Reputation: 334Reputation: 334
Quote:
Originally Posted by Kenny83 View Post
I have two machine A and B.
Both machines run on the Redhat Enterprise 5.8.
I have a script named test.sh on the machine B.
The directory of the script is /root/Desktop/test.sh.
The script contain a while loop to listen the serial port message.
I need to use machine A to execute the scripts on the machine B using root account.
Thus, I use the command [ssh machineB /root/Desktop/test.sh].
The script hangs on the machine A because of the while loop.
Thus, I use the command [ssh machineB /root/Desktop/test.sh &].
However, the process appears on the machine A.
How to solve it?
Try:
Code:
ssh machineB 'nohup /root/Desktop/test.sh &'
 
  


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
more xfce 4.10 startup/shutdown scripts or run properly {gpg|ssh}-agent rpetrov Slackware - Installation 1 12-03-2012 02:16 AM
Scripts that run on SSH login ashaquick Linux - Newbie 3 03-13-2011 12:46 PM
ssh and running of remote scripts question babag Linux - Networking 3 05-30-2008 04:54 AM
[SSH]Which login scripts are run? jamesstanley Linux - Server 3 11-17-2007 06:24 AM
logging, remote ssh, scripts, and the at command gctaylor1 Programming 4 01-29-2007 08:22 AM


All times are GMT -5. The time now is 10:06 PM.

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