LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   How could I make the a file on two computers the exact same? (http://www.linuxquestions.org/questions/linux-software-2/how-could-i-make-the-a-file-on-two-computers-the-exact-same-910428/)

ThatPerson 10-27-2011 04:38 AM

How could I make the a file on two computers the exact same?
 
I have two computers, both of which I use for development, so I want to have the source code files the same on both. They both run Ubuntu 11.10, and both have the source in the same directories (/home/ben/Programs/C/Crimson), and are both on the same network. Currently, I email the files, or use Bluetooth, however both of these are rather slow at sending them, and I would not know which is the most recent. Is there a program which can be put on both, and get the files (If they are newer, so if computer2 has it updated at 10:00PM, and computer 1 at 9:00PM, it would copy the computer2 one onto computer1, could you tell me? If not, how could I make the file be the same? I have tried Ubuntu One, and products like it, but these seem rather slow at uploading (I have a 40KB/s connection uploading, and 300KB/s downloading, but both computers have 802.11n, which should be much faster, as the folder is 2MB, the uploading would take about 51 seconds to upload and then about 6 to download, a total of 57 seconds, where as using the 802.11n network, it would be done in (If n only reaches about 100MB/s) 0.02 seconds, which is much faster), so I would prefer a application which works on my network.

Oh, by the way, the slow web speeds are because of the service provider. The internal network is Wireless N.

droyden 10-27-2011 04:57 AM

You could use rsync, but if you are developing you should maybe use source control? Svn or git. You could also use nfs from one of the servers and mount it on hybrid other one

ThatPerson 10-27-2011 05:09 AM

Quote:

Originally Posted by droyden (Post 4509636)
You could use rsync, but if you are developing you should maybe use source control? Svn or git. You could also use nfs from one of the servers and mount it on hybrid other one

Thanks for the tips, I will look into them later. By the second one, couldn't I also set them up as FTP servers, and FTP from one to the other to put the new stuff on, and have it set to the directory? How would this be done?

m_kane 10-27-2011 05:58 AM

why make it so difficult way?
Just share folder from other computer using nfs and then mount it to other. Then you have files in one location only.

This of course means that you must have sharing computer running all time. If you don't want that, then buy a cheap network disk where you store files.

Good idea is also backup your files using rsync and cron job regularly, even if you use files from two computers. Then you can easily go back if something happens.

If you want to use "cloud", you can setup dropbox folder to both computers. Then dropbox keeps files updated in both automatically. It just copies changed files over network, so I think it fast in your case.

ThatPerson 10-27-2011 06:15 AM

Quote:

Originally Posted by m_kane (Post 4509670)
why make it so difficult way?
Just share folder from other computer using nfs and then mount it to other. Then you have files in one location only.

This of course means that you must have sharing computer running all time. If you don't want that, then buy a cheap network disk where you store files.

Good idea is also backup your files using rsync and cron job regularly, even if you use files from two computers. Then you can easily go back if something happens.

If you want to use "cloud", you can setup dropbox folder to both computers. Then dropbox keeps files updated in both automatically. It just copies changed files over network, so I think it fast in your case.


If I use nfs with this tutorial, would the files stay in /home/user with the NFS? If it was turned off would they stay? Would it just be that one PC is connecting to the other's directory?

David the H. 10-27-2011 12:29 PM

You might try the unison file synchronizer.

http://www.cis.upenn.edu/~bcpierce/unison/

It works kind of like a 2-way rsync, and lets you choose which direction to propagate if the same file has been updated differently on both ends. You can even tell it to call an external program like diff in order to merge files if you want.

m_kane 10-27-2011 12:41 PM

Quote:

Originally Posted by ThatPerson (Post 4509683)
If I use nfs with this tutorial, would the files stay in /home/user with the NFS? If it was turned off would they stay? Would it just be that one PC is connecting to the other's directory?

Files will stay, nfs just shares directories to other users.

k3lt01 10-27-2011 12:47 PM

DropBox is one option. Dropbox syncs automatically, as long as you have an internet connection, so the most recent version is always the one that is available.

ThatPerson 10-27-2011 01:46 PM

Quote:

Originally Posted by David the H. (Post 4509973)
You might try the unison file synchronizer.

http://www.cis.upenn.edu/~bcpierce/unison/

It works kind of like a 2-way rsync, and lets you choose which direction to propagate if the same file has been updated differently on both ends. You can even tell it to call an external program like diff in order to merge files if you want.

Perfect. Thanks!

Quote:

Originally Posted by k3lt01 (Post 4509986)
DropBox is one option. Dropbox syncs automatically, as long as you have an internet connection, so the most recent version is always the one that is available.

As I said in the first post, I have tried things like DropBox and Ubuntu One and found them too slow.

k3lt01 10-27-2011 03:19 PM

Quote:

Originally Posted by ThatPerson (Post 4510026)
As I said in the first post, I have tried things like DropBox and Ubuntu One and found them too slow.

Are you sure there may not be another issue then? I would be checking your connection then because I have no such problem with DropBox and I have some pretty big files in my DB folder. I have heard UbuntuOne can be slow but I have never used it so cannot comment.

ThatPerson 10-27-2011 03:27 PM

Quote:

Originally Posted by k3lt01 (Post 4510095)
Are you sure there may not be another issue then? I would be checking your connection then because I have no such problem with DropBox and I have some pretty big files in my DB folder. I have heard UbuntuOne can be slow but I have never used it so cannot comment.

Very slow web connection. About 200KB/s download, and 40KB/s upload. For a 1MB file, it takes quite a while. I am going to have a look into dropbox, just incase.


All times are GMT -5. The time now is 12:23 AM.