LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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, 12:29 PM   #1
babag
Member
 
Registered: Aug 2003
Posts: 368

Rep: Reputation: 30
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, 01:06 PM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

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

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

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

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
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, 01:51 PM   #5
babag
Member
 
Registered: Aug 2003
Posts: 368

Original Poster
Rep: Reputation: 30
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, 02:01 PM   #6
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
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, 02:03 PM   #7
babag
Member
 
Registered: Aug 2003
Posts: 368

Original Poster
Rep: Reputation: 30
thanks again!
 
  


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

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

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