bcpierce00 / unison

Unison file synchronizer
GNU General Public License v3.0
3.86k stars 224 forks source link

A probably simple feature request: Simple support for post processing #1039

Closed schittli closed 3 weeks ago

schittli commented 1 month ago

Hello thanks a lot for sharing your great and very useful work - for more than 1/4 century! πŸ˜ƒ

I think I have a simple little improvement suggestion that could serve many users / open up new user groups:

Initial situation

It would therefore be very useful:

  1. If the unison exit code would additionally return a new code for: "All files were already up to date. (Unison has not changed any file)". This would make it very easy for the Unison caller to perform post-sync actions. Important: The exit code must say if the files on the local server, on the remote server or on both servers have been changed.
  2. Or: It would be brilliant if we could configure something like: PostProcessorOnFileChanged: <path to command / script>: This command / script would be executed as soon as the synchronization has changed at least one file. Important: Unison must pass a parameter which tells if files on the local server, on the remote server or on both servers have been changed.

Thanks a lot, kind regards, Thomas

celane commented 1 month ago

Just a quick comment about this:

1 Unison is great for synchronizing files 1:1 to mirror

between systems.

But synchronizing config files, that need some post-update processing is a rather different task, and is more of a "1:N" task (one main host configuring many others).

I need both of these tasks, but for the propagating config files? I use a utility called "synctool" https://github.com/walterdejong/synctool because once you head down the path of dealing with config files, then you're in a maze of twisty little passages, all different.

On Fri, 24 May 2024 06:00:39 -0700 Tom-- @.***> wrote:

Hello thanks a lot for sharing your great and very useful work - for more than a quarter century! πŸ˜ƒ

I think I have a simple little improvement suggestion that could serve many users / open up new user groups:

Initial situation

  • I love unison to sync configuration files between redundant computers because it is pretty simple to set up.
  • But: Some services like the nginx community edition need to be informed if the configuration files have been changed (here by unsion synchronization).

It would therefore be very useful:

  1. If the unison exit code would additionally return a new code for: "All files were already up to date. (Unison has not changed any file)". This would make it very easy for the Unison caller to perform post-sync actions. 2. Or: It would be brilliant if we could configure something like: PostProcessorOnFileChanged: <path to command / script>: This command / script would be executed as soon as the synchronization has changed at least one file.

Thanks a lot, kind regards, Thomas

-- Drexel University  |/             /    ·   ν ·   Chuck Lane   |D ======]--->---C-----π+--<                Disque 911  |U Particle Physics    \             \    ~~ e+~~   215-895-1545 |N @.***      -​μ+--+νν                 |E

schittli commented 1 month ago

Hello @celane,

Thank you very much for your reference to syntool!

That's why unison is a much simpler and more elegant solution:

  1. one logs on to any computer where a configuration needs to be changed
  2. one makes the change and test it
  3. Unison will do the reast

This workflow is really great, because a system engineer can work as usual. The only thing is that if a file had to be synchronized, Unison does not report this event via exit code and does not offer to execute a command for this event.

I therefore very much hope that it will be very easy for Unison to return an additional exit code or read the config file and execute a command.

But synchronizing config files, that need some post-update processing (…) is more of a "1:N" task (one main host configuring many others).

I've been in IT for 30 years in companies with 12 to 750 employees and have never once had the situation you describe. So I'm pretty sure that a lot of people can benefit from a Unison that somehow signals that files have been modified πŸ˜€. The background to this is that we could only ever do load balancing and failover with 2 servers at a time - that was always completely sufficient.

Thanks a lot, kind regards, Thomas

gdt commented 3 weeks ago

The issue tracker is only for fully-baked feature requests. Since we're already having an argument about how best to re-implement Ansible with unison, this isn't one of those :-) I am curious whether you did not see https://github.com/bcpierce00/unison/wiki/Reporting-Bugs-and-Feature-Requests or whether you did and thought this belonged here vs the list?

I have moved this issue to

https://github.com/bcpierce00/unison/wiki/Feature-Requests

Please feel free to bring this up one one of the mailinglists. (Also, if you aren't proposing to develop the feature yourself, it's pretty unlikely anything would happen.)