Closed phmarek closed 2 years ago
Hi Philipp :-)
Do I even want to know the details about when exactly you think this would be useful? ;-)
Did you look into using "drbdsetup events2" for that? Or better yet, utilizing https://github.com/LINBIT/drbd-reactor?
Well, it was a quick one-off encrypted data replication; the SSH tunnel broke down a few times (I believe because of misconfigurations - my fault, didn't do DRBD for too long ;), and so I noticed the asymmetry of the drbdsetup wait-
commands.
And no - a separate daemon just because an rsync is running in the background isn't worth the effort.
Yeah, drbdsetup events2 | grep ... --line-buffered | head -1 && ...
might have worked, but this just shows some inherent complexity that drbdsetup wait-
wouldn't have had... ;)
Thanks for the quick help!
In this case you are right, drbd-reactor
would not have been the right choice. Just in case if somebody else finds this issue in the future: For all things related to drbd state changes and triggering some custom actions, the umh plugin should be a good choice:
The user mode helper is a plugin that allows users to specify filters matched on DRBD state changes. If a filter rule matches, a user defined script gets executed. Information is passed to scripts via environment variables.
drbdsetup
has very nicewait-connect
andwait-sync
commands; it would be great if there would be more of them, to more easily trigger actions in shell scripts. For example,drbdsetup wait-disconnect-resource
would be nice.Thanks a lot!