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
checking ERRors in files ali560045 Shell Programming and Scripting 4 06-19-2008 10:56 AM
checking entries between files za_7565 Shell Programming and Scripting 8 12-19-2007 05:54 AM
how to login into another ip and checking for the files saikumar_n UNIX for Advanced & Expert Users 1 07-11-2007 10:13 AM
checking for files on ftp... jithinravi UNIX for Dummies Questions & Answers 3 06-22-2007 11:25 AM
Checking modified time of files am97395331 UNIX for Dummies Questions & Answers 4 07-02-2003 10:55 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-10-2007
saikumar_n saikumar_n is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 2
how to login into another ip and checking for the files

Hi All,
Good Day.
need one help regarding unix script.
i have to check whether the particular file is there or not in another ip address.
suppose....there is file in this ip address 2.160.64.130 in particualar location.
i have to veify this from another ip adress(Say 2.160.64.131).if the file is present then i have to send an alert

please provide the answer for this problem


Thanks
N.S.kumar
  #2 (permalink)  
Old 07-10-2007
robotronic's Avatar
robotronic robotronic is offline Forum Advisor  
Can I play with madness?
  
 

Join Date: Apr 2002
Location: Italy
Posts: 370
Code:
TEST=`rsh 2.160.64.130 "if [ -f "/path/to/filename" ]; then echo PRESENT; fi"`

if [ "$TEST" ]
then
   echo "Alert!!!"
fi
Bye.
  #3 (permalink)  
Old 07-11-2007
robotronic's Avatar
robotronic robotronic is offline Forum Advisor  
Can I play with madness?
  
 

Join Date: Apr 2002
Location: Italy
Posts: 370
Hi,
rsh executes the specified command on the remote host using the same user which executes the rsh command on the local host.
For example, if you are logged in as the user "john" and execute:

Code:
rsh remote_host "ls -lrt"
then the specified command (ls -lrt) will be executed on the machine "remote_host" using the remote user "john", which must exist on the remote machine.

Otherwise, you must provide the remote user with the "-l user" option:

Code:
rsh -l dave remote_host "ls -lrt"
You obtain "permission denied" because the remote host doesn't "trust" your local host, so it couldn't estabilish a connection. To correct the problem, you must create in the home directory of the remote user on the remote server a hidden file called ".rhosts", containing the ip address (or the hostname) of your local host. However, this mechanism is insecure. If you want a secure connection you must install and use a tool like ssh (secure shell).

Suppose you are the user "john" on your localhost 2.160.64.131 an you wish to connect to the remote host 2.160.64.130 with the same user (john). In this situation you must create the ".rhosts" file in the home directory of the user "john" on the server 2.160.64.130; in this file you have to simply put a line containing the ip address "2.160.64.131".

In addition you must ensure that the login is enabled for the user "john" on the remote host (i.e. the user account is not locked).

Bye bye
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 05:20 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