Live data from Hacker News

Systemd: Enable indefinite service restarts

michael.stapelberg.ch

81–83 of 83 posts

Re: Systemd: Enable indefinite service restarts

#81
post #80
post #72

Earlier quoted context omitted.

edit: I did some more investigation, and I missed something crucial: The distribution of requests over time becomes very wonky if the lower bound isn't 0. It stabilizes given enough time, but that time seems very long. Whereas lower-bound 0 quickly becomes uniform. See the following figure, where I plot the # of requests over type: https://i.imgur.com/PNUFhjc.png And that is why you should use 0. --- I am not an expe…

Yeah, all fair. What piqued my curiosity is that you could wait _less_ time than you did before (potentially not at all!) which feels like the opposite of what you want to do in such situations.

Indeed, it was a good question. That's why I couldn't let it go either. I personally find the result quite interesting. Counterintuitive, but the most uniformly distributed load is probably the most likely to recover.

As always, https://xkcd.com/356/

Re: Systemd: Enable indefinite service restarts

#82
post #59

Earlier quoted context omitted.

Or a disk not attached yet. Or another service it depends on being slow to finish starting up.

So, you two know how systemd gets heat for doing too much, right? This is one of those things. The 'After=' and 'Requires=' directives address this. Depends on a mount? Point those directives at a '.mount' unit. Depends on networking, perhaps a specific NIC? Point those directives at 'systemd-networkd-wait-online@$REQUIRED_NIC.service' Point being: declare these things, don't wait for entropy to eventually become sta…

After and Requires are only when starting the service though. If a service (stupidly) crashes when a network connection is temporarily down (someone tripped over the router's power cord?), it needs to restart until the network connection is back up.

Re: Systemd: Enable indefinite service restarts

#83

Earlier quoted context omitted.

So, you two know how systemd gets heat for doing too much, right? This is one of those things. The 'After=' and 'Requires=' directives address this. Depends on a mount? Point those directives at a '.mount' unit. Depends on networking, perhaps a specific NIC? Point those directives at 'systemd-networkd-wait-online@$REQUIRED_NIC.service' Point being: declare these things, don't wait for entropy to eventually become sta…

After and Requires are only when starting the service though. If a service (stupidly) crashes when a network connection is temporarily down (someone tripped over the router's power cord?), it needs to restart until the network connection is back up.

Sure, but now we're kind of back where we started: 'Restart='

With the requirements properly laid out we've avoided restarting in a loop and a bit of robustness

There's also 'PartOf=' which can help make the relationship bidirectional

Post reply on HN