Python Forum
Sync folder over network
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sync folder over network
#1
Hi all!
I've a software (in Python) that run in 25 PCs (10 with windows and 15 with Ubuntu). Sometimes I need to update that software. So I need to sync a remote folder with the folder of that software in those 25PCs. The software contains a server Python.

I was thinking about starting a process in the remote computer that send a message to all computers' servers telling them to update.

At this point the server in every computer starts a process that sync its folder with the remote folder.

The problem is that I can't find anything for syncing 2 remote folder. I was thinking about python but I'm open to other ideas.

Is there some library that allows this? I need to oput an ftp server in the remote folder?

P.S. If the sync is a problem, it could be ok just to copy the folder.
Reply
#2
rsync

Google 'rsync linux to windows share'.

You have to map the remote folder to the local directory and it's good to make one for each remote address. Something like:

/PCs
    |/192.168.1.100/
    |/192.168.1.101/
    |/192.168.1.102/
    |/192.168.1.xxx/
    |/192.168.1.149/
Then whit a simple script you can sync all you need from the local dir or a single file.

See cwrsync
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#3
Thank you for the answer. These days I'll try rsync.
Reply
#4
I don't know how familiar are you with cli interface but you can create these directories that way (bash):

mkdir -p PCs/192.168.1.{001..050}

$ mkdir -p PCs/192.168.1.{001..050}
$ ls PCs/
192.168.1.001  192.168.1.011  192.168.1.021  192.168.1.031  192.168.1.041
192.168.1.002  192.168.1.012  192.168.1.022  192.168.1.032  192.168.1.042
192.168.1.003  192.168.1.013  192.168.1.023  192.168.1.033  192.168.1.043
192.168.1.004  192.168.1.014  192.168.1.024  192.168.1.034  192.168.1.044
192.168.1.005  192.168.1.015  192.168.1.025  192.168.1.035  192.168.1.045
192.168.1.006  192.168.1.016  192.168.1.026  192.168.1.036  192.168.1.046
192.168.1.007  192.168.1.017  192.168.1.027  192.168.1.037  192.168.1.047
192.168.1.008  192.168.1.018  192.168.1.028  192.168.1.038  192.168.1.048
192.168.1.009  192.168.1.019  192.168.1.029  192.168.1.039  192.168.1.049
192.168.1.010  192.168.1.020  192.168.1.030  192.168.1.040  192.168.1.050
With a help of a little shell script, you can map these dirs to the shared remote dirs to avoid the manual work. I do not know bash syntax very well but it's a simple approach:
#!/bin/bash
#
for directory in $(ls /path/PCs/); do
    # mount the remote directory here
done
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020