I have two computers connected to the same home network. I would like to synchronize certain folders between the two. In the past I already used unison for this purpose and I think this could be a good solution. This time I would like to automatize the process, in order not to rely on my memory...

I'm thinking about using cron and the command line version of unison to set up a daily backup. Now, for the synchronization to happen both computers must be on at the same time, which is not always the case.

To solve this problem I thought that a good idea would be to create a small script on one of the two computers (let's call it PC1). The script should do the following operations:

  1. Check if the other computer (PC2) is on.
  2. If PC2 is off then do nothing.
  3. If PC2 is on then check when the last synchronization happened
  4. If the two PCs synchronized last time less that 24 hours ago (for example) then do nothing.
  5. If the last synchronization happened more that 24 hours before that execute unison

At that point I can run the script every 10 minutes on PC1. While PC2 is off nothing happens. As soon as PC2 is on, then unison is executed once. If both PC1 and PC2 remains on for a while no sync will take place, unless more than 24 hours pass. I think this should work, at least in theory.

The question is that I don't know how to implement points from 3 to 5. How can I check when last sync happened? Is there another solution to my problem? Please, take into account that I would like not to use cloud storage (huge files to synchronize, speed, etc).



From your description, you might want to take a good look at BTSync. This is a p2p syncing application but it uses only self-hosted storage.

On Linux, it relies on a config file and web interface but should still be easier to get going than unison.

Advantages over unison:

  • easy setup
  • strong support for all OSes
  • Mobile clients (access your files like a cloud as long as any of the PCs are on)
  • seamless switching from LAN sync to over the internet

The main disadvantage is this is closed-source software from BitTorrent.

If you want to try it, you can find more information on ask here: How to run BitTorrent Sync?

  • Hi Oliver, Thanks for your reply. If I understood properly BTSync is now called getsync (getsync.com). I had a look to the web page and indeed it seems to be a good solution for my problem. Even the free version can handle and unlimited number of folders and there is no size limit. I will definitely try it. – Matteo Jan 24 '16 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.