LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-04-2008, 11:29 AM   #1
babag
Member
 
Registered: Aug 2003
Posts: 419

Rep: Reputation: 31
ssh question


is there a way to silently call ssh so that it doesn't
appear in my local terminal?

i'm using a bash script to call a remote box via ssh.
all it does is start a script on the remote box and then
returns back to my local. once running, the remote script
keeps interrupting my local screen with updates as it
progresses. i don't want that. i have a kvm switch so i
can easily monitor the remote that way.

how do i make the ssh call such that i won't get constant
screen updates from the remote?

thanks,
BabaG
 
Old 06-04-2008, 12:06 PM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
What about redirecting the standard output of the script to a file?
 
Old 06-04-2008, 12:18 PM   #3
babag
Member
 
Registered: Aug 2003
Posts: 419

Original Poster
Rep: Reputation: 31
how would i do that?

thanks,
BabaG
 
Old 06-04-2008, 12:43 PM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Input/output redirection is the basic of shell scripting. Just do
Code:
ssh user@host "command > logfile"
this redirects the standard output of the command (script) to logfile on the remote machine. The following will redirect the output to a file on the local machine: note the different position of the redirection: inside the double quotes in the command above, outside in the command below.
Code:
ssh user@host "command" > logfile
 
Old 06-04-2008, 12:51 PM   #5
babag
Member
 
Registered: Aug 2003
Posts: 419

Original Poster
Rep: Reputation: 31
thanks colucix. that's a great idea. will try it out tomorrow
when i'm back at those machines. one question:

can i adapt your 'logfile' to a specific path and filename?
i'm guessing it's yes but, never having done this, i thought
i should ask.

thanks again. very helpful!
BabaG
 
Old 06-04-2008, 01:01 PM   #6
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Of course. You can redirect to whatever you want: a file with its full or relative path, an existing file or a new one, you can overwrite or append. For example to append the output to an existing file on the remote machine you will do
Code:
ssh user@host "command >> /path/to/some/existing/file"
 
Old 06-04-2008, 01:03 PM   #7
babag
Member
 
Registered: Aug 2003
Posts: 419

Original Poster
Rep: Reputation: 31
thanks again!
 
  


Reply



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
Question About SSH carlosinfl Linux - Security 9 02-23-2006 10:27 AM
ssh-agent/ssh-add question mega Slackware 2 01-26-2005 03:09 AM
ssh question drj000 Linux - Networking 3 12-09-2004 02:21 AM
ssh question pdelucia Linux - Security 1 07-09-2003 02:54 PM
question about ssh erikm103 Linux - General 2 03-11-2003 02:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:53 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
Open Source Consulting | Domain Registration