Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 05-27-2008, 10:39 PM   #1
Registered: Aug 2003
Posts: 368

Rep: Reputation: 30
running bash scripts over ssh connection

i want to ssh into a remote mandriva box from a local one
to start a bash script on that remote box.

i'm using a command like this:
ssh user@ip_address_of_remote ./path/and/script_to_run &
since this will not be running in a terminal but from a
script, how will i know when the remote script has completed?

i ask this because i want to run a second script once the
first one completes. ideally, i'd like to have the script
on the remote run the same as i'm used to when i run it locally,
that would be to say, if i were to walk over to the remote and
look at its screen, i'd see a terminal with the script's
output displaying. the only difference would be that the script
had been started from elsewhere.

also, to start a second script, do i need to log out and back
in from the remote? how does one log out of the ssh connection
from within a script? how would i run successive scripts like
ssh user@ip_address_of_remote ./path/and/script_to_run &
ssh user@ip_address_of_remote ./path/and/script_2_to_run &
and lastly, if i were to start a command line app over the
ssh connection, how would i pass parameters to the command
line app?
ssh user@ip_address_of_remote ./path/and/app_to_run -parameter1 -parameter2 &
Old 05-27-2008, 11:07 PM   #2
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912
For the first lot of scripts I'd suggest
ssh user@ip_address_of_remote "./path/and/script_to_run && ./path/and/script_2_to_run &"


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
SSH connection refused, no firewall and confirmed running amdinator Linux - Networking 4 05-16-2007 03:18 PM
running ssh connection into batch file jdonaldogg General 1 12-17-2005 10:25 PM
SSH connection termination during a running process... jayemef Linux - General 1 08-16-2005 11:41 AM
bash scripts and running .sh files xviddivxoggmp3 Programming 9 08-14-2004 05:33 AM
Running bash scripts from C++ application bfkeats Programming 1 06-18-2003 05:44 PM > Forums > Linux Forums > Linux - Newbie

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

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