On Tue, Apr 25, 2023 at 07:18:12PM -0000, Stuart Henderson wrote:
>On 2023-04-25, [email protected] <[email protected]> wrote:
>> On Tue, Apr 25, 2023 at 08:32:35PM +0200, Antoine Jacoutot wrote:
[..]
>
>So let's ignore this ls -l red herring, which cannot have worked
>in 7.2 either (I think you might have meant to type ~${daemon_user}
>or something, but anyway..)
>
>The rc.d subsystem is really intended for internal use by system
>daemons, ports, etc. As such, changes are sometimes made to how
>it works, and everything is updated in ports/base as necessary,
>but if you're writing your own you will need to keep track of
>those changes yourself.
>
>I think what you're missing are these two commits:
Thanks for these.
>
>----------------------------
>revision 1.153
>date: 2022/05/21 10:50:09; author: ajacoutot; state: Exp; lines: +13 -6;
>commitid: iyDYBSL549hXuvMg;
>Replace the $rcexec variable by an rc_exec function.
>It is much cleaner to the eyes and makes more sense from a functionnal point of
>view.
>This will allow to extend rc_exec with other functionnalities (like upcoming
>rc_startdir).
>Bonus point: daemon_logger will now work with manually crafted rc_start
>functions.
>
>This will require a mechanical change from ${rcexec} to rc_exec in rc.d
>scripts.
>ports will be fixed right after this commit but we will keep compatibility to
>give a chance to people to fix their custom scripts.
>
>positive tests from a few
>ok robert@
>----------------------------
>
>----------------------------
>revision 1.160
>date: 2022/10/19 21:04:45; author: ajacoutot; state: Exp; lines: +1 -3;
>commitid: A78P0jfG7qlNxhdx;
>Drop support for $rcexec; people should now use the rc_exec function.
>
>prodded by jsg@
>----------------------------
>
>though FWIW I think this should be split into two scripts,
>the subsystem isn't geared up to handle one script dealing with
>two separate daemons. (or alternatively what I normally do when
>I use autossh here is to add @reboot cron jobs)...
I don't disagree it should be two separate scripts, but I haven't
found a way to gracefully start/stop separate instances of autossh
since it forks into a separate process.
So if ${daemon} is declared as "autossh", using the built-in
pexp="${daemon}:.*" would kill off multiple running autossh
instances.
Running these out of rc, rather than cron, I find to be a bit more
graceful during network hiccups.