MFC r208190, r229667, r230541, r230869, r231909, r231910, r231911, r231912:
r208190 (ivoras):
Slightly improve wording.
r229667, r230541, r230869 (ghelmer):
Change the notes about the pidfile to include Doug's preference
for pre-creating the pidfile with appropriate owner and permissions.
Requested by dougb
r231909:
The pidfile_open(3) is going to be fixed to set close-on-exec in order
not to leak the descriptor after exec(3). This raises the issue for
daemon(3) of the pidfile lock to be lost when the child process
executes.
To solve this and also to have the pidfile cleaned up when the program
exits, if a pidfile is specified, spawn a child to exec the command
and wait in the parent keeping the pidfile locked until the child
process exits and remove the file.
Reported by: Andrey Zonov <andrey zonov org>
Suggested by: pjd
Reviewed by: pjd
r231910:
If the supervising process receives SIGTERM, forward it to the spawned
process. Normally it will cause the child to exit followed by the
termination of the supervisor after removing the pidfile.
This looks like desirable behavior, because termination of a
supervisor usually supposes termination of its charge. Also it will
fix the issue with stale pid files after reboot due to init kills a
supervisor before its child exits.
r231911:
Add -r option to restart the program if it has been terminated.
Suggested by: Andrey Zonov <andrey zonov org>
r231912:
If permitted protect the supervisor against pageout kill.
Suggested by: Andrey Zonov <andrey zonov org>
git-svn-id: svn://svn.freebsd.org/base/stable/8@233762
ccf9f872-aa2e-dd11-9fc8-
001c23d0bc1f