Steve Litt on 5 Aug 2018 18:38:53 -0700 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: [PLUG] LINUX ADMIN ADVICE |
On Fri, 3 Aug 2018 18:32:36 -0400 Rich Freeman <r-plug@thefreemanclan.net> wrote: > On Fri, Aug 3, 2018 at 2:27 PM Steve Litt <slitt@troubleshooters.com> > wrote: > > > > Observe the following runit run script: > > > > ===================================================== > > #!/bin/sh > > if network_up; then > > exec thedaemon --forground > > fi > > sleep 1 > > ===================================================== > > > > Wow, that is equivalent to 1 line in a service unit (or more likely > about 15 characters more on an existing line), except that for systemd > that unit would also start the service on boot, The preceding run script *does* start the service on boot. > and also shut down the > daemon when the network is down. In other words, for a service that depends on a functional network, yet doesn't abort on network timeout, but would cause problems by not aborting, you need this feature. That's a corner case, to say the least. But OK, I could build the polling solution to this problem in an afternoon. The interrupt solution would take me longer, but I'm pretty sure it's easily doable. > No need to sleep at the end > either... True. I can remove the sleep, but I didn't want retries to happen too quickly, so I put the sleep. The sleep costs nothing. SteveT Steve Litt Author: The Key to Everyday Excellence http://www.troubleshooters.com/key Twitter: http://www.twitter.com/stevelitt ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug