Compare file in other sever


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Compare file in other sever
# 1  
Old 10-10-2011
Compare file in other sever

Hi All,
I have totally two server. First server name is ABC which contains the file name is Sum.txt and Second server name is Sun here one file generate during the runtime.

Currently I am in First Server. Now, I need to compare the server one file (Sum.txt) with server two file.

If it doesn't match, i have to exit from the script.

Any help is really appreciated.
# 2  
Old 10-10-2011
SCP the file from Server ABC to Second server..
Code:
scp Sum.txt username@Sun:/your/path/in/Sun/Server

Then in Second server, find the difference..
Code:
$ diff Sum.txt runtime-file
$ [ $? -ne 0 ] && echo "Not matching" || echo "Matching"

# 3  
Old 10-10-2011
You need set keyless login by SSH first.
Code:
diff first.txt <(ssh username@Sun cat second.txt)

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

LAMP Sever

How do I install a LAMP server on a new installation of Debian 9 using the lalest versions of AMP? Here is what I have. Corrections please. MYSQL apt-get install mysql-server mysql-client You can verify the MySQL server status using command: systemctl status mysql ------- PHP7... (0 Replies)
Discussion started by: Meow613
0 Replies

2. Red Hat

Cloning an empty sever (except OS) onto a smaller drive?

Actually this is a Centos 6.x question, but I think it fits here. I have a client that has a pretty beefy server that will be running all sorts of VMs once I unleash it to the developers. For several reasons, they would like to do a complete clone of the server as is right now, that is with just... (2 Replies)
Discussion started by: xdawg
2 Replies

3. BSD

Ping remote sever, nc, telnet, whatever

I put this thread to shell and bsd, because I want to resolve this matter on bsd. May somebody can explain to me how to ping a remote server, in unix. BTW the following code examples were tried on a linux system as well, with the same output, nothing. But on my bsd are not installed nmap neither... (4 Replies)
Discussion started by: 1in10
4 Replies

4. Shell Programming and Scripting

Need to Take Sent Mail Backup in Linux Sever

Everyday my code will send 100's* of mails from linux server to outlook using*sendmail command . I need to take a backup of those mails which are exactly sent from my linux server. This is needed for backup purpose. backuplocation is my local home dir.Is it possible to do this. I dont have root... (4 Replies)
Discussion started by: mohanalakshmi
4 Replies

5. AIX

Any Additional Steps After Adding New RAM To Sever?

Hi All, We have a server at a client site running AIX 5.3, which we just up the RAM to 32GB, from initially 16GB (if I'm not mistaken). This server is our Application server running J2EE applications on top of Oracle Internet Application Server. Recently we encountered one of the batch jobs... (12 Replies)
Discussion started by: a_sim
12 Replies

6. Shell Programming and Scripting

FTPying files from one sever to another server but into specified file.

Hi Friends, My requirement is - I have to FTP a list of files from one server to another sever. I am using following code : ftp -i -n << EOF >> abc.txt open $COM_FTP_RHOST user $COM_FTP_USER $COM_FTP_PASSWORD cd $COM_FTP_PATH ( some folder ) ls -ltr filename* bye EOF After... (1 Reply)
Discussion started by: sree143reddy
1 Replies

7. Shell Programming and Scripting

need to check whether a sever is pingable or not inside the script

Hi, need to write a script which will check number of ip address are able to ping or not .. (2 Replies)
Discussion started by: mail2sant
2 Replies

8. Shell Programming and Scripting

Run command on remote sever from script

I have two redhat linux server. i have created one script which contain some command that run on Local server as well as remote server.I am using this command to connect to remote server ssh user1@192.x.x.x 'command' but when i am running the script in local server it connecting to the server... (1 Reply)
Discussion started by: ranvijaidba
1 Replies

9. AIX

find the IP's on the sever

Hi , I am working on AIx server which is connected to another network which is a stock market via leased line , From my side I connect to the server locally but what i need is to know the ip whic the server connect to the stock market how I can Know this ???? Thanks (1 Reply)
Discussion started by: habuzahra
1 Replies

10. Shell Programming and Scripting

Running a script on a different Sever

Guys, I want to run a script located on a different server from my pc. Let say the server has an IP of 1.1.10.2/16 and the script path is: /home/user/bin/check.sh The script scans for all available devices on the lan. My pc has an IP of 1.1.15.4/16 and I can ping the sever and can... (3 Replies)
Discussion started by: tony3101
3 Replies
Login or Register to Ask a Question