Directory comparision between two server


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Directory comparision between two server
# 1  
Old 08-05-2011
Directory comparision between two server

Hi,

I am trying to write a shell script that will give the comparision between two server

for example:

Server 1 : /a/b/c
Server 2: /a/b/c

First login to Server1 and check the dir sturcture and then login to Server2 and get the dir stucuture and then compare...and if there is difference need to send a mail.
# 2  
Old 08-05-2011
Try one of the following
but I do recommeond either ssh way or rsync way
1- rsync way
Code:
$ rsync -avnc --delete /a/b/c/  server2:/a/b/c/

2-remote mount way
Also try something like this if you can mount the remote directory from the sever2 :
you could mount the two directories in such a way that you could do something like:
Code:
$ diff -q /a/b/c /pathtobemounted |sort

perhaps you can try ssh mount using sshFS.

3- ssh way
Code:
$ ssh Server1 "tree -s -f /a/b/c " > /tmp/out1 && ssh Server2 "tree -s -f /a/b/c " > /tmp/out2 && diff /tmp/out1 /tmp/out2

# 3  
Old 08-08-2011
Hi Sir,

Thanks for you reply

I am new to unix...

Tried executing above query, however was getting the error..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to preserve time stamp while copying a directory from Server B to Server A?

Experts, Please help me out here. How to preserve time stamp while copying a directory from Server B to Server A (3 Replies)
Discussion started by: ahmed.vaghar
3 Replies

2. Shell Programming and Scripting

How to get the latest file from a directory in Server B to Server A?

ssh user@hostnameB cd /home/oracle latest_file_target=$(ls -trp -I "*.pd.Sat" -I "*.pd.Lag" -R | grep -v "/.pd" | tail -1) scp -r $latest_file_target user@hostnameA:$TARGET_DIR/ exit (1 Reply)
Discussion started by: ahmed.vaghar
1 Replies

3. Solaris

Ftp a directory to another server from the local server what is the command

ftp a directory to another server from the local server what is the command (2 Replies)
Discussion started by: PMoore
2 Replies

4. Shell Programming and Scripting

FTP files from different directory from remote server to one directory in local

Hi All, I want to search for .log files from folders and sub folders in remote server and FTP them to one particular folder in the local machine. I dont want to copy the entire directory tree structure, just have to take all the .log files from all the folders by doing a recursive search from the... (3 Replies)
Discussion started by: dassv
3 Replies

5. AIX

link directory across server

Hi All, I have directory "A" on server "1". I also have directory "B" on Server "2" I need to link these 2 directories "A" and "B" which are across servers. Is it possible? If so, can somebody help me on this? Thanks in advance. Mugundan (2 Replies)
Discussion started by: mjdarm
2 Replies

6. Shell Programming and Scripting

Help with server/directory sync

Hi guys, can you help. I have looked all over the site and can not find the info I'm after. Perhaps I am missing something very obvious. I want to syncronise between 2 servers, I can not use NFS mount/share. So I have been looking at scp, rsync, rdist. Thing is, I want only the newer files to... (2 Replies)
Discussion started by: Boloic
2 Replies

7. Solaris

Directory Server + RBAC on one server

Hello everyone, I have been trying to find a way to setup a directory server working with RBAC on Solaris. I will try to figure out my environment and my concerns. Here we go : - I have Unix servers mostly running Solaris 10 and 9 in my environment. - I have users/user groups that need to... (4 Replies)
Discussion started by: niyazi
4 Replies

8. UNIX for Dummies Questions & Answers

How to mount a directory on one server to another?

Question 1) I have directory /home/userme/reports on server 1 and I want to mount that directory anywhere on server 2. How do I make this happen? Question 2) Server 2 is behind a firewall and server 1 is public...by mounting server 1 on server 2 do I compromise the security of server 2? (3 Replies)
Discussion started by: vincaStar
3 Replies

9. Solaris

How to mount a directory on another server?

Hi, I have two solaris 10 servers, and I want a directory (test) in server A be accessible in server B. I searched the web and the concept should be as follows: Server A: # share -F nfs /home/nms/test Server B: # mount -F nfs serverA:/home/nms/test /home/nms/test But when I... (1 Reply)
Discussion started by: racbern
1 Replies

10. Solaris

Map Unix server directory to another Unix server directory

Hi, Anybody knows how to map a particular server directory to another server directory. Both servers are unix. For example when i view the files in server A /export/home/web/doc/ , I am actually viewing the files in server B /export/home/web/doc. Have been looking for a solution for a long time.... (2 Replies)
Discussion started by: sagolo
2 Replies
Login or Register to Ask a Question