0

Short background

I have built a small cluster of linux machines and been creating and running scripts for distributed computing. After having gotten some basic things up and running now I'm tuning my scripts trying to adapt timings to do some primitive load balancing. To get this working I think I will need to sync the machines somehow.

Question

If I have a samba share for files which are working as a communication platform storing work lists and results. Is there some way (preferrably built into samba configuration or something of the sort) in which I can restamp files automatically "on arrival" to the samba server using the server time?


Own Solution found so far

Having a separate samba server side script just touching all the incoming files as they arrive will give them the same relative time. It still won't solve the issue if we would need to know relative times samba server vs the clients but at least the server can compare the times.

mathreadler
  • 115
  • 6

1 Answers1

1

Normally, incoming files are timestamped with server time. In other words, mtime would be equal to server time during last upload/modify.

However, clients are free to change mtime as they want. This is exploited, for example, by cp -a and rsync -a, as they preserve source-side last modify time (mtime).

So, the obvious question is: how do you upload your files? Can you use a method/command with non-time-preserving semantic?

Alternatively, you can use ntp to sync all clients with a common, trusted time source.

shodanshok
  • 47,711
  • 7
  • 111
  • 180
  • Great comment, I will check the commands. It's in a script so I am using "mv -f ..." to avoid having to confirm any overwrite. Maybe that "-f" could do something? – mathreadler Mar 08 '16 at 10:19
  • 1
    `mv` simply moves a file without touching it, so it leave `mtime` unchanged. You have two possibilities: 1) immediately after `mv`, `touch` the moved file or b) use `cp` or `rsync` instead of `mv` – shodanshok Mar 08 '16 at 10:38
  • So "cp" would by default have another behaviour than "mv"? I never even thought of that possibility. Thanks a bunch. – mathreadler Mar 08 '16 at 10:52