pleaserun
pleaserun copied to clipboard
"reload" for init scripts, where applicable
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?
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.
Initial work on sysv and systemd at https://github.com/ctdk/pleaserun/tree/reload
Looks like a pretty good start!
Yeah, the changes work fine, but they need some tests before too long. Soon, hopefully.