Connect server2 from server1 to compare files


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Connect server2 from server1 to compare files
# 1  
Old 04-10-2013
Connect server2 from server1 to compare files

Hi ALL,

Requirement:Connect server2 from server1 and get the list of files generate on currentdate .

Basically i need to check the files in server1 and server2 on currrent date is equal on each 1 hr frequency.

Can anyone help me on this.

Thanks in advance

Hari
# 2  
Old 04-10-2013
how about something like

Code:
CHECK_DIR=/path/to/check

if diff -q <(find $CHECK_DIR -mtime -1 -print) <(ssh server2 find $CHECK_DIR -mtime -1 -print) > /dev/null
then
    echo "Files are the same"
else
    echo "Files are different"
fi

# 3  
Old 04-10-2013
Hi

Showing err

Syntax error at line 4 : `(' is not expected

---------- Post updated at 05:18 AM ---------- Previous update was at 05:03 AM ----------

Hi


Idea is to when the scheduled sh file is executed it should match the files
between 2 servers and send mail whether it matches or not.

so there shouldn't be a pause or login issue in script execution

is it possible to hardcode uid and pwd in script.


thanks in advance

Hari
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

File Management: Removing of files from Server2 IF the same file is removed from Server1.

Hi Folks, I have a requirement of file management on different servers. Source Server is SERVER-A. Two servers will fetch files from SERVER-A: SERVER1 and SERVER2. 4th SERVER is SERVER-B, It will fetch files from SERVER1. If SERVER1 goes DOWN, SERVER-B will fetch pending files from... (2 Replies)
Discussion started by: Raza Ali
2 Replies

2. Shell Programming and Scripting

How to display files of server2 in server1?

hi, i have two servers in unix. say server1 and server2. my shell script is running on server1. In server2, there is a directory (/etc/data/) which contains some text files. I want to write the list of filenames in server2 in a file and display the file in server1. In short, i want to... (3 Replies)
Discussion started by: Little
3 Replies

3. Shell Programming and Scripting

Compare multiple files, and extract items that are common to ALL files only

I have this code awk 'NR==FNR{a=$1;next} a' file1 file2 which does what I need it to do, but for only two files. I want to make it so that I can have multiple files (for example 30) and the code will return only the items that are in every single one of those files and ignore the ones... (7 Replies)
Discussion started by: castrojc
7 Replies

4. Shell Programming and Scripting

Require compare command to compare 4 files

I have four files, I need to compare these files together. As such i know "sdiff and comm" commands but these commands compare 2 files together. If I use sdiff command then i have to compare each file with other which will increase the codes. Please suggest if you know some commands whcih can... (6 Replies)
Discussion started by: nehashine
6 Replies

5. Shell Programming and Scripting

Compare 2 folders to find several missing files among huge amounts of files.

Hi, all: I've got two folders, say, "folder1" and "folder2". Under each, there are thousands of files. It's quite obvious that there are some files missing in each. I just would like to find them. I believe this can be done by "diff" command. However, if I change the above question a... (1 Reply)
Discussion started by: jiapei100
1 Replies

6. Shell Programming and Scripting

How to compare 2 files & get only few columns based on a condition related to both files?

Hiiiii friends I have 2 files which contains huge data & few lines of it are as shown below File1: b.dat(which has 21 columns) SSR 1976 8 12 13 10 44.00 39.0700 70.7800 7.0 0 0.00 0 2.78 0.00 0.00 0 0.00 2.78 0 NULL ISC 1976 8 12 22 32 37.39 36.2942 70.7338... (6 Replies)
Discussion started by: reva
6 Replies

7. Virtualization and Cloud Computing

Sun Cluster3.2 on Vmware Server2.0

I'm trying to configure sun cluster 3.2 on vmware server 2.0 on windows xp host with solaris 10x86 guests VM3 and VM4 and i 'm running scinstall from VM4 .. it fails with following error Initializing cluster name to "laptop" ... done Initializing authentication options ... done Initializing... (0 Replies)
Discussion started by: fugitive
0 Replies

8. Shell Programming and Scripting

compare files in two directories and output changed files to third directory

I have searched about 30 threads, a load of Google pages and cannot find what I am looking for. I have some of the parts but not the whole. I cannot seem to get the puzzle fit together. I have three folders, two of which contain different versions of multiple files, dist/file1.php dist/file2.php... (4 Replies)
Discussion started by: bkeep
4 Replies

9. Shell Programming and Scripting

how to append file contents at server1 to another file in server2

hi is there any way to append the file contents at server1 to another file in server2 by using scp. right now am transferring files to the server2 and using cat command for appending... (2 Replies)
Discussion started by: aemunathan
2 Replies

10. Shell Programming and Scripting

Ftp from server1 and upload to server3 from server2

Hi , i have three server server1 -> Unix OS ,ftp enable IP ->10.8.219.190 server 2 -> Unix OS ,ftp enable NIC 1 IP ->10.8.219.191 ,NIC2 ->192.168.0.5 server3 -> windows OS ,ftp enable NIC1 ->192.168.0.6. hence server 1 and server 3 can not communicate ,but server 2 can... (1 Reply)
Discussion started by: suchintkotia
1 Replies
Login or Register to Ask a Question