I can do it the same way the MySQL driver handles extra parameters: you
list them with the others. The code strips off the ones it recognizes, then
passes the rest on to the rsync command.

On Tue, Apr 2, 2024 at 4:08 PM 'John Kline' via weewx-user <
weewx-user@googlegroups.com> 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 <chris...@gmail.com> 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 <chri...@gmail.com> 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 weewx-user+unsubscr...@googlegroups.com.
> 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 weewx-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/AE72C34C-BB70-4EDE-83CD-03BF9877BA24%40johnkline.com
> <https://groups.google.com/d/msgid/weewx-user/AE72C34C-BB70-4EDE-83CD-03BF9877BA24%40johnkline.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 weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zEBTprpnpaywdKbQnkJgGrSHXvG0BQe5NuuydUZG3mg_Og%40mail.gmail.com.

Reply via email to