pleaserun icon indicating copy to clipboard operation
pleaserun copied to clipboard

"reload" for init scripts, where applicable

Open ctdk opened this issue 9 years ago • 4 comments

Sometimes, you might want a "reload" command for an init script rather than just "restart". Unfortunately the way to do that varies between the different kinds of init systems out there. SysV init supports it with no real trouble, and systemd has ExecReload to specify a command to use to reload the program.

Beyond that, it gets a little hairy. I've been unable to find any evidence that launchd supports reload at all, and while the latest version of upstart does, I am told previous versions do not. Also, the version of upstart that does support reload only allows you to send a signal to the program in question.

So, reload would have to be implemented differently on each platform. There may not be one good way to do it across all platforms that support it, but perhaps other folks have ideas on how to best implement it across the different platforms. Any ideas?

ctdk avatar Sep 27 '14 05:09 ctdk

For SysV and systemd, it might work to have a --reload option to pleaserun, with a sensible default (like kill -HUP $pid (or $MAINPID) that could be overridden. Upstart could use a --reload option and an optional signal (default SIGHUP) for those versions that allow it.

This feels a little clunky, but I'm not sure there's a better way.

ctdk avatar Sep 27 '14 05:09 ctdk

Initial work on sysv and systemd at https://github.com/ctdk/pleaserun/tree/reload

ctdk avatar Sep 28 '14 06:09 ctdk

Looks like a pretty good start!

jordansissel avatar Oct 07 '14 06:10 jordansissel

Yeah, the changes work fine, but they need some tests before too long. Soon, hopefully.

ctdk avatar Oct 07 '14 17:10 ctdk