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.
Details
- Reviewers
kevans imp - Commits
- rG7618c9e1637c: daemon: Add -C (--restart-count) option
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
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).
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. |
usr.sbin/daemon/daemon.c | ||
---|---|---|
60 |
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 |
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). |