What's the best way to restart the daemontools service?

You have added a code update to the daemontools service and you want to restart it so it picks up the changes. The service itself is simple and does not have built-in signal processing. Which is the best way?

  • svc -d; sleep 5; svc -u

    Sends TERM followed by CONT. Waits for the service to actually exit and then restart it.
  • svc -h

    Sends a HUP signal. The process will die on receiving a signal, and daemontools will restart it.

I always made some changes in the first one, but someone pointed out that today we can really do HUP just as well and I like it better, but I have been doing it differently for so long, Can't remember if there was a reason.

I thought it might be because a process in uninterrupted sleep waiting for I / O ignores signals, but according to wikipedia , "When a process crashes smoothly, signals accumulated during sleep will be seen when the process returns from a system call. or traps. "

Does anyone have an informed opinion on best practice?


source to share

2 answers

It looks like option 2 (sending a HUP signal) is somewhat cleaner, but in the end both will get the job done, and neither is superior in nature.



Send SIGHUP. It is shorter to dial and won't keep you waiting that long.



All Articles