how to login into another ip and checking for the files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to login into another ip and checking for the files
# 1  
Old 07-10-2007
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  
Old 07-10-2007
Code:
TEST=`rsh 2.160.64.130 "if [ -f "/path/to/filename" ]; then echo PRESENT; fi"`

if [ "$TEST" ]
then
   echo "Alert!!!"
fi

Bye.
# 3  
Old 07-11-2007
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Checking in a directory how many files are present and basing on that merge all the files

Hi, My requirement is,there is a directory location like: :camp/current/ In this location there can be different flat files that are generated in a single day with same header and the data will be different, differentiated by timestamp, so i need to verify how many files are generated... (10 Replies)
Discussion started by: srikanth_sagi
10 Replies

2. UNIX for Dummies Questions & Answers

Need help in checking for files in subfolders

Hi, I am trying to print a listing of files from the top level directory, check to see if any files have the same name as the top level directory name and if so, cd to that file and list the files under it. Don't know how to check for the file in the next level. What I have so far: ... (6 Replies)
Discussion started by: tes218
6 Replies

3. Shell Programming and Scripting

Cross checking two files

i have two files which contains some fields separated by columns as 03/29/1999 08:48:12 02 172.16.114.50 03/29/1999 09:08:00 480 172.16.112.100 Both of the files do have the same format I want the script which will take two such... (3 Replies)
Discussion started by: vaibhavkorde
3 Replies

4. Shell Programming and Scripting

checking thorough files and renamingit

hi all am very new to unix scripting..... i have a work right now that i should complete by End of Day :( scenario is i get some x number of files with .csv extension on a specified path at my operating system. the names of the files are as follows . the record lay out is same... (0 Replies)
Discussion started by: rajesh_tns
0 Replies

5. Shell Programming and Scripting

Checking for presence of any files

Is there code in Cshell scripting to check for the presence of any files in the current directory (and only the current directory)? I tried: if (-r *) then ... but Cshell doesn't like that. Thanks, Paul Hudgens (0 Replies)
Discussion started by: phudgens
0 Replies

6. Shell Programming and Scripting

Checking for presence of any files

I have tried the following script to check for the presence of any files in a folder: if (-r *) then goto ZipMiscFiles else echo "" echo " No Miscellaneous files found. Exiting program." echo "" exit endif The -r works fine with the wildcard in combo with other... (4 Replies)
Discussion started by: phudgens
4 Replies

7. UNIX for Dummies Questions & Answers

Checking files extension

Hi, I need one line command to display all files that ends with .scr. Example: In a directory I have 10 files, out of that 4 files have filetype extension .dat and 4 files with .scr and 2 files with .txt.... In this i want to display only files that ends with .scr. I tried some commands,... (2 Replies)
Discussion started by: gwgreen1
2 Replies

8. Shell Programming and Scripting

checking ERRors in files

I m having trouble in a script.I need To write a script that will check for Following Errors in Logs Files,i.e files having Extension .log The erros are 2008-01-01 15:19:11,822 ERROR - ORA-01115: IO error reading block from file 51 (block # 717090) ORA-01110: data file 51:... (4 Replies)
Discussion started by: ali560045
4 Replies

9. UNIX for Advanced & Expert Users

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... (1 Reply)
Discussion started by: saikumar_n
1 Replies

10. UNIX for Dummies Questions & Answers

checking for files on ftp...

I have automated my ftp session as given in on of the previous threads as: #! /usr/bin/ksh HOST=remote.host.name USER=whoever PASSWD=whatever exec 4>&1 ftp -nv >&4 2>&4 |& print -p open $HOST print -p user $USER $PASSWD print -p cd directory print -p binary print -p get xyz wait... (3 Replies)
Discussion started by: jithinravi
3 Replies
Login or Register to Ask a Question