LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-27-2008, 11:39 PM   #1
babag
Member
 
Registered: Aug 2003
Posts: 367

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:
Code:
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
this?
Code:
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?
Code:
ssh user@ip_address_of_remote ./path/and/app_to_run -parameter1 -parameter2 &
thanks,
BabaG
 
Old 05-28-2008, 12:07 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

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


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


All times are GMT -5. The time now is 12:31 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