From 7e6fe25ca591804e5f55ce11640226a89c78d6ed Mon Sep 17 00:00:00 2001 From: trociny Date: Sun, 19 Feb 2012 10:36:29 +0000 Subject: Add -r option to restart the program if it has been terminated. Suggested by: Andrey Zonov MFC after: 2 weeks --- usr.sbin/daemon/daemon.8 | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'usr.sbin/daemon/daemon.8') diff --git a/usr.sbin/daemon/daemon.8 b/usr.sbin/daemon/daemon.8 index b9cf97e..2f9cb6b 100644 --- a/usr.sbin/daemon/daemon.8 +++ b/usr.sbin/daemon/daemon.8 @@ -71,16 +71,28 @@ owner is the user who runs the regardless of whether the .Fl u option is used or not. -If the monitoring +.It Fl r +Supervise and restart the program if it has been terminated. +.It Fl u Ar user +Login name of the user to execute the program under. +Requires adequate superuser privileges. +.El +.Pp +If the +.Fl p +or +.Fl r +option is specified the program is executed in a spawned child process. +The +.Nm +waits until it terminates to keep the pid file locked and removes it +after the process exits or restarts the program. +In this case if the monitoring .Nm receives software termination signal (SIGTERM) it forwards it to the spawned process. Normally it will cause the child to exit followed by the termination of the supervising process after removing the pidfile. -.It Fl u Ar user -Login name of the user to execute the program under. -Requires adequate superuser privileges. -.El .Sh EXIT STATUS The .Nm -- cgit v1.1