The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Converting a Windows system to a UNIX system baksg1995 UNIX for Dummies Questions & Answers 6 09-17-2008 06:34 AM
how to mount a file system of a remote machine to local file system cy163 UNIX for Dummies Questions & Answers 2 01-31-2008 09:04 AM
rsh commands not getting executed from Solaris 10 System to AIX System jumadhiya SUN Solaris 25 01-22-2007 05:26 AM
Secure FTP Problem using Sun SSH on Client system F-Secure on Server system ftpguy SUN Solaris 2 01-11-2007 12:19 PM
Taking a system off a network on a system Terrible Shell Programming and Scripting 4 12-25-2006 09:49 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-04-2009
mogabr mogabr is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 32
ssh on system

hello

i am using sshpass to pass the password when trying to ssh to another system with script

it works like that
sshpass -p 'm7843jdf' ssh -o StrictHostKeyChecking=no serverXY

the problem i wants to run application commands after i login like the following

cd /opt/monitor/roco
connect
./show models | wc -l
disconnect

and then grep the output in a file localy

how to do so ?
  #2 (permalink)  
Old 02-04-2009
quirkasaurus's Avatar
quirkasaurus quirkasaurus is offline
Registered User
  
 

Join Date: Jan 2009
Location: canton, michigan
Posts: 373
Seems to work okay:

Code:
sshpass -p 'm7843jdf' ssh -o StrictHostKeyChecking=no serverXY " command; command2; command3" | grep whatever > here.txt
  #3 (permalink)  
Old 02-09-2009
mogabr mogabr is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 32
Quote:
Originally Posted by quirkasaurus View Post
Seems to work okay:

Code:
sshpass -p 'm7843jdf' ssh -o StrictHostKeyChecking=no serverXY " command; command2; command3" | grep whatever > here.txt
hello

i have tried above the problem when excute the command on the remote server it retrun error
Error: variable CLISESSID not set

it looks like the command should be excuted correct on the server or ssh options need to be modified
  #4 (permalink)  
Old 02-09-2009
avronius avronius is offline VIP Member  
VIP Member
  
 

Join Date: Apr 2008
Location: Calgary
Posts: 305
Looks like you need to have your first command be to change your environment variable(s)

Last edited by avronius; 02-09-2009 at 05:11 PM.. Reason: spelling error
  #5 (permalink)  
Old 02-09-2009
mogabr mogabr is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 32
Quote:
Originally Posted by avronius View Post
Looks like you need to have your first command be to change your environment variable(s)
how to do so ?
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:13 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0