Page MenuHomeFreeBSD

daemon: Add -C (--restart-count) option
Needs ReviewPublic

Authored by otis on Thu, Apr 25, 1:43 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 27, 6:56 PM
Unknown Object (File)
Fri, Apr 26, 2:19 PM
Unknown Object (File)
Fri, Apr 26, 2:17 PM
Unknown Object (File)
Fri, Apr 26, 2:17 PM
Unknown Object (File)
Fri, Apr 26, 8:49 AM
Unknown Object (File)
Thu, Apr 25, 9:54 PM
Unknown Object (File)
Thu, Apr 25, 8:59 PM

Details

Reviewers
kevans
imp
Summary

Add a new option (-C, --restart-count) to specify the maximum
number of times that the controlled process is restarted if
restart (-r) is restarted.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 57413
Build 54301: arc lint + arc unit

Event Timeline

otis requested review of this revision.Thu, Apr 25, 1:43 PM
otis created this revision.

And while here, also mandoc -Tlint a bit.

lgtm, whats this addressing? Whats the system behaviour when the count limit is hit?

lgtm, whats this addressing? Whats the system behaviour when the count limit is hit?

it is addressing a case when you only want the process supervised to be restarted only certain amount of times (and then not restarted at all). it is a complementary switch to -r (--restart). when the limit is hit, daemon(8) will terminate as usual.

you can then, for example, monitor the processes more easily (like, check for daemon(8) as well as for the supervised proces).

0mp added inline comments.
usr.sbin/daemon/daemon.8
73

-C should go before -c.

77

The maximum number of restarts should be documented as well.

81

The final period can be written at the end of this line:

.Fl -restart .

Address comments from 0mp

otis marked 3 inline comments as done.Thu, Apr 25, 2:48 PM
usr.sbin/daemon/daemon.c
60

I think I'm missing someting in the design; why the arbitrary limit here? It seems reasonable, but it's not clear to me that we really care if someone wants to say restart it 512 times then call it good.

349

I'm not sure that it makes sense to have this mode when -C 0 is used -- if they requested restart, then it feels a little weird to have a knob to immediately disable that indirectly. I don't think I strongly object, though.

otis marked 2 inline comments as done.Thu, Apr 25, 6:21 PM
otis added inline comments.
usr.sbin/daemon/daemon.c
60

I think I'm missing someting in the design; why the arbitrary limit here? It seems reasonable, but it's not clear to me that we really care if someone wants to say restart it 512 times then call it good.

there has to be some limit. 512 seemed too much, 32 too less. 128 seemed reasonable to me. anyway, I don't insist on this value, perhaps as little as 16 or 32 would also do.

349

I'm not sure that it makes sense to have this mode when -C 0 is used -- if they requested restart, then it feels a little weird to have a knob to immediately disable that indirectly. I don't think I strongly object, though.

if you call this from a script, let's say, you only need to parametrize one value (the value for -C) while keeping the rest of the command unmodified. that's my imagination of a use case (at least the one I can think of from my experience).

otis marked 2 inline comments as done.

rebase