Agree that one way to do it would be ideal, unless there are backward compatibility reasons to leave the current switches 'also' valid. I guess it would be possible to tear apart a hypothetical rsync_options="whatever here" string to not break folks, but I didn't want to write the code this time, just suggest where it might be doable to at least think about as a feature addition.
On Tuesday, April 2, 2024 at 4:08:26 PM UTC-7 John Kline wrote: > The problem with an rsync_options (similar to the existing ssh_options) is > that the code already has rsync options specified individually (e.g., > delete and compress). It would be messy to have two ways to specify delete > and compress. > > It might be best to add an explicit exclude option. BTW, exclude can be > specified multiple times, so the value should be an array. > > On Apr 2, 2024, at 11:56 AM, Chris Alemany <[email protected]> wrote: > > Hmm, both strategies have advantages. It'd be great if weewx had the > ability to add in rsync options so that if you just wanted to do a single > thing, exclude a directory, or maybe conform to a specific non-standard > setting on the remote host, then you can easily do that in weewx. > > > The extension is nice to have to create a full suite of rsync options so > people can use it to backup stuff, move stuff, etc. > > I've created a GitHub issue/request > https://github.com/weewx/weewx/issues/951 > > Thanks to you both. > Chris > On Tuesday, April 2, 2024 at 8:30:30 AM UTC-7 vince wrote: > >> Seems complicated. >> >> I was suggesting something like adding a general purpose 'rsync_options' >> variable in that section of weewx.conf, and adding the value to the >> assembled rsync command in the run(self) routine in rsyncupload.py ? >> Then the user could add any combination of the rsync options to the command >> if needed. Perhaps something like the following (untested): >> >> pi@pi4:/tmp$ diff rsyncupload.py.orig rsyncupload.py -u >> --- rsyncupload.py.orig 2024-04-02 08:18:48.311469290 -0700 >> +++ rsyncupload.py 2024-04-02 08:19:57.970078706 -0700 >> @@ -46,6 +46,7 @@ >> self.delete = delete >> self.port = port >> self.ssh_options = ssh_options >> + self.rsync_options = rsync_options # <== new >> self.compress = compress >> self.log_success = log_success >> self.log_failure = log_failure >> @@ -96,6 +97,7 @@ >> if self.timeout is not None: >> cmd.extend(["--timeout=%s" % self.timeout]) >> cmd.extend(["-e"]) >> + cmd.extend([rsync_options]) # <=== new >> cmd.extend([rsyncsshstring]) >> cmd.extend([rsynclocalspec]) >> cmd.extend([rsyncremotespec]) >> >> And add a rsync_options = "whatever you want here" to the [[RSYNC]] >> section in weewx.conf ala: >> >> [[RSYNC]] >> delete = 0 >> skin = Rsync >> enable = true >> server = x.x.x.x >> user = myremoteuser >> path = /my/remote/path/here >> log_success = true >> log_failure = true >> rsync_options = "-x -y -z whatever" # <=== new >> >> Disclaimer - totally untested and no idea if there are security risks of >> doing it this way, but it would seem to be about as flexible as you can get >> toward supporting whatever rsync options the underlying os supports with a >> minimum of change to the existing uploader.... >> >> On Tuesday, April 2, 2024 at 1:17:58 AM UTC-7 Glenn McKechnie wrote: >> >>> On Tue, 2 Apr 2024 at 15:00, Chris Alemany <[email protected]> wrote: >>> >>>> Thanks for the hints Vince. I ended up looking through the old Wiki and >>>> came upon this page about backing up databases with the rsync report and >>>> how you can spit rsync into multiple skins. >>>> >>>> >>>> https://github.com/weewx/weewx/wiki/Using-the-RSYNC-skin-as-a-backup-solution >>>> >>> >>> That was a good solution for a while, until - like you - I wanted more. >>> >>> I eventually pulled the rsyncupload.py code from the main tree and >>> stuffed it into a skin. >>> The following was written a while ago. I still use it as is, but it's >>> rough and untidy. Really does need a clean up but I haven't and still >>> don't have the time do that, so you get it warts and all... >>> >>> https://github.com/glennmckechnie/weewx-rsynctransfer >>> >>> It should install *Gulp*, it should be self explanatory *Gulp* >>> There are plenty of notes and examples in it that show it can handle the >>> additional rsync command line options. >>> >>> my email address is in the code, there's the issues tab on github and I >>> always read this group. >>> >>> Cheers >>> Glenn >>> >>> Various WeeWx addons at >>> https://github.com/glennmckechnie >>> >> -- > You received this message because you are subscribed to the Google Groups > "weewx-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/weewx-user/0d2bbda5-dc2c-4075-bcae-44b6b4c01063n%40googlegroups.com > > <https://groups.google.com/d/msgid/weewx-user/0d2bbda5-dc2c-4075-bcae-44b6b4c01063n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/9e81f999-3e60-4b31-88cb-3d1ddbd74cc0n%40googlegroups.com.
