[gentoo-commits] proj/openrc:master commit in: /, src/rc/, man/, sh/
commit: c1e582586d398b4452f568240985247294f645ef Author: William Hubbs gmail com> AuthorDate: Tue Oct 9 22:49:02 2018 + Commit: William Hubbs gentoo org> CommitDate: Tue Oct 23 18:38:14 2018 + URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=c1e58258 supervise-daemon: add health checks Health checks are a way to monitor a service and make sure it stays healthy. If a service is not healthy, it will be automatically restarted after running the unhealthy() function to clean up. NEWS.md | 4 ++ man/supervise-daemon.8| 9 +++ sh/supervise-daemon.sh| 14 + src/rc/Makefile | 2 +- src/rc/supervise-daemon.c | 136 +++--- supervise-daemon-guide.md | 36 6 files changed, 169 insertions(+), 32 deletions(-) diff --git a/NEWS.md b/NEWS.md index d4d96577..f1400197 100644 --- a/NEWS.md +++ b/NEWS.md @@ -22,6 +22,10 @@ This version adds timed shutdown and cancelation of shutdown to openrc-shutdown. Shutdowns can now be delayed for a certain amount of time or scheduled for an exact time. +supervise-daemon supports health checks, which are a periodic way to make sure a +service is healthy. For more information on setting this up, please see +supervise-daemon-guide.md. + ## OpenRC 0.37 start-stop-daemon now supports logging stdout and stderr of daemons to diff --git a/man/supervise-daemon.8 b/man/supervise-daemon.8 index af06ee31..8bcd8b5c 100644 --- a/man/supervise-daemon.8 +++ b/man/supervise-daemon.8 @@ -16,6 +16,10 @@ .Nd starts a daemon and restarts it if it crashes .Sh SYNOPSIS .Nm +.Fl a , -healthcheck-timer +.Ar seconds +.Fl A , -healthcheck-delay +.Ar seconds .Fl D , -respawn-delay .Ar seconds .Fl d , -chdir @@ -90,6 +94,11 @@ Print the action(s) that are taken just before doing them. .Pp The options are as follows: .Bl -tag -width indent +.Fl a , -healthcheck-timer Ar seconds +Run the healthcheck() command, possibly followed by the unhealthy() +command every time this number of seconds passes. +.Fl A , -healthcheck-delay Ar seconds +Wait this long before the first health check. .It Fl D , -respawn-delay Ar seconds wait this number of seconds before restarting a daemon after it crashes. The default is 0. diff --git a/sh/supervise-daemon.sh b/sh/supervise-daemon.sh index 80e0260c..73a70140 100644 --- a/sh/supervise-daemon.sh +++ b/sh/supervise-daemon.sh @@ -10,6 +10,8 @@ # This file may not be copied, modified, propagated, or distributed #except according to the terms contained in the LICENSE file. +extra_commands="healthcheck unhealthy ${extra_commands}" + supervise_start() { if [ -z "$command" ]; then @@ -32,6 +34,8 @@ supervise_start() ${respawn_delay:+--respawn-delay} $respawn_delay \ ${respawn_max:+--respawn-max} $respawn_max \ ${respawn_period:+--respawn-period} $respawn_period \ + ${healthcheck_delay:+--healthcheck-delay} $healthcheck_delay \ + ${healthcheck_timer:+--healthcheck-timer} $healthcheck_timer \ ${command_user+--user} $command_user \ ${umask+--umask} $umask \ ${supervise_daemon_args:-${start_stop_daemon_args}} \ @@ -98,3 +102,13 @@ supervise_status() return 3 fi } + +healthcheck() +{ + return 0 +} + +unhealthy() +{ + return 0 +} diff --git a/src/rc/Makefile b/src/rc/Makefile index 9ba240fa..ea4a8c81 100644 --- a/src/rc/Makefile +++ b/src/rc/Makefile @@ -161,7 +161,7 @@ rc-update: rc-update.o _usage.o rc-misc.o start-stop-daemon: start-stop-daemon.o _usage.o rc-misc.o rc-pipes.o rc-schedules.o ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD} -supervise-daemon: supervise-daemon.o _usage.o rc-misc.o rc-schedules.o +supervise-daemon: supervise-daemon.o _usage.o rc-misc.o rc-plugin.o rc-schedules.o ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD} service_get_value service_set_value get_options save_options: do_value.o rc-misc.o diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c index 27089152..883c738d 100644 --- a/src/rc/supervise-daemon.c +++ b/src/rc/supervise-daemon.c @@ -61,15 +61,18 @@ static struct pam_conv conv = { NULL, NULL}; #include "queue.h" #include "rc.h" #include "rc-misc.h" +#include "rc-plugin.h" #include "rc-schedules.h" #include "_usage.h" #include "helpers.h" const char *applet = NULL; const char *extraopts = NULL; -const char *getoptstring = "D:d:e:g:I:Kk:m:N:p:R:r:Su:1:2:3" \ +const char *getoptstring = "A:a:D:d:e:g:H:I:Kk:m:N:p:R:r:Su:1:2:3" \ getoptstring_COMMON; const struct option longopts[] = { + { "healthcheck-timer",1, NULL, 'a'}, + { "healthcheck-delay",1, NULL, 'A'}, { "respawn-delay",1, NULL, 'D'}, { "chdir",1, NULL, 'd'}, { "env",
[gentoo-commits] proj/openrc:master commit in: src/rc/, man/
commit: 3f918161aafa61c1c2005709fda0b9bec4c412d8 Author: William Hubbs gmail com> AuthorDate: Fri Oct 5 19:10:59 2018 + Commit: William Hubbs gentoo org> CommitDate: Thu Oct 18 22:56:36 2018 + URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=3f918161 openrc-shutdown: Add scheduled shutdown and the ability to cancel a shutdown You can now schedule a shutdown for a certain time or a cpecific number of minutes into the future. When a shutdown is running, you can now cancel it with ^c from the keyboard or by running "openrc-shutdown -c" from another shell. man/openrc-shutdown.8| 3 + src/rc/Makefile | 4 +- src/rc/broadcast.c | 209 +++ src/rc/broadcast.h | 16 src/rc/openrc-shutdown.c | 179 ++-- 5 files changed, 402 insertions(+), 9 deletions(-) diff --git a/man/openrc-shutdown.8 b/man/openrc-shutdown.8 index 5db21334..b09e8c20 100644 --- a/man/openrc-shutdown.8 +++ b/man/openrc-shutdown.8 @@ -16,6 +16,7 @@ .Nd bring the system down .Sh SYNOPSIS .Nm +.Op Fl c , -cancel .Op Fl d , -no-write .Op Fl D , -dry-run .Op Fl H , -halt @@ -32,6 +33,8 @@ is the utility that communicates with to bring down the system or instruct openrc-init to re-execute itself. It supports the following options: .Bl -tag -width "poweroff" +.It Fl c , -cancel +Cancel a pending shutdown. .It Fl d , -no-write Do not write the wtmp boot record. .It Fl D , -dry-run diff --git a/src/rc/Makefile b/src/rc/Makefile index b09c5058..9ba240fa 100644 --- a/src/rc/Makefile +++ b/src/rc/Makefile @@ -14,7 +14,7 @@ SRCS+=rc-selinux.c endif ifeq (${OS},Linux) -SRCS+= kill_all.c openrc-init.c openrc-shutdown.c rc-wtmp.c +SRCS+= kill_all.c openrc-init.c openrc-shutdown.c broadcast.c rc-wtmp.c endif CLEANFILES=version.h rc-selinux.o @@ -134,7 +134,7 @@ mountinfo: mountinfo.o _usage.o rc-misc.o openrc rc: rc.o rc-logger.o rc-misc.o rc-plugin.o _usage.o ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD} -openrc-shutdown: openrc-shutdown.o _usage.o rc-wtmp.o +openrc-shutdown: openrc-shutdown.o rc-misc.o _usage.o broadcast.o rc-wtmp.o ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD} openrc-run runscript: openrc-run.o _usage.o rc-misc.o rc-plugin.o diff --git a/src/rc/broadcast.c b/src/rc/broadcast.c new file mode 100644 index ..dbc861d1 --- /dev/null +++ b/src/rc/broadcast.c @@ -0,0 +1,209 @@ +/* + * broadcast.c + * broadcast a message to every logged in user + */ + +/* + * Copyright 2018 Sony Interactive Entertainment Inc. + * + * This file is part of OpenRC. It is subject to the license terms in + * the LICENSE file found in the top-level directory of this + * distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE + * This file may not be copied, modified, propagated, or distributed + *except according to the terms contained in the LICENSE file. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "broadcast.h" +#include "helpers.h" + +#ifndef _PATH_DEV +# define _PATH_DEV "/dev/" +#endif + +#ifndef UT_LINESIZE +#define UT_LINESIZE __UT_LINESIZE +#endif + +static sigjmp_buf jbuf; + +/* + * Alarm handler + */ +/*ARGSUSED*/ +# ifdef __GNUC__ +static void handler(int arg __attribute__((unused))) +# else +static void handler(int arg) +# endif +{ + siglongjmp(jbuf, 1); +} + +static void getuidtty(char **userp, char **ttyp) +{ + struct passwd *pwd; + uid_t uid; + char*tty; + static char uidbuf[32]; + static char ttynm[UT_LINESIZE + 4]; + + uid = getuid(); + if ((pwd = getpwuid(uid)) != NULL) { + uidbuf[0] = 0; + strncat(uidbuf, pwd->pw_name, sizeof(uidbuf) - 1); + } else { + if (uid) + sprintf(uidbuf, "uid %d", (int) uid); + else + sprintf(uidbuf, "root"); + } + + if ((tty = ttyname(0)) != NULL) { + const size_t plen = strlen(_PATH_DEV); + if (strncmp(tty, _PATH_DEV, plen) == 0) { + tty += plen; + if (tty[0] == '/') + tty++; + } + snprintf(ttynm, sizeof(ttynm), "(%.*s) ", +UT_LINESIZE, tty); + } else + ttynm[0] = 0; + + *userp = uidbuf; + *ttyp = ttynm; +} + +/* + * Check whether the given filename looks like a tty device. + */ +static int file_isatty(const char *fname) +{ + struct stat st; + int major; + +
[gentoo-commits] proj/openrc:master commit in: src/rc/, man/
commit: 08da36149c0b41c64a09369c3eef5e2f5a6fa39c Author: William Hubbs gmail com> AuthorDate: Wed May 16 18:25:22 2018 + Commit: William Hubbs gentoo org> CommitDate: Wed May 16 18:25:22 2018 + URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=08da3614 rc-service: add --ifstarted and --ifstopped options man/rc-service.8| 8 src/rc/rc-service.c | 16 +++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/man/rc-service.8 b/man/rc-service.8 index 2834f361..72d5a559 100644 --- a/man/rc-service.8 +++ b/man/rc-service.8 @@ -40,6 +40,14 @@ .Ar service cmd .Op Ar ... .Nm +.Op Fl s , -ifstarted +.Ar service cmd +.Op Ar ... +.Nm +.Op Fl S , -ifstopped +.Ar service cmd +.Op Ar ... +.Nm .Fl e , -exists .Ar service .Nm diff --git a/src/rc/rc-service.c b/src/rc/rc-service.c index ea69dab5..8b01fa0d 100644 --- a/src/rc/rc-service.c +++ b/src/rc/rc-service.c @@ -29,7 +29,7 @@ const char *applet = NULL; const char *extraopts = NULL; -const char *getoptstring = "cdDe:ilr:INZ" getoptstring_COMMON; +const char *getoptstring = "cdDe:ilr:INsSZ" getoptstring_COMMON; const struct option longopts[] = { { "debug", 0, NULL, 'd' }, { "nodeps", 0, NULL, 'D' }, @@ -38,6 +38,8 @@ const struct option longopts[] = { { "ifexists", 0, NULL, 'i' }, { "ifinactive", 0, NULL, 'I' }, { "ifnotstarted", 0, NULL, 'N' }, + { "ifstarted", 0, NULL, 's' }, + { "ifstopped", 0, NULL, 'S' }, { "list", 0, NULL, 'l' }, { "resolve", 1, NULL, 'r' }, { "dry-run", 0, NULL, 'Z' }, @@ -73,6 +75,8 @@ int main(int argc, char **argv) bool if_exists = false; bool if_inactive = false; bool if_notstarted = false; + bool if_started = false; + bool if_stopped = false; applet = basename_c(argv[0]); /* Ensure that we are only quiet when explicitly told to be */ @@ -124,6 +128,12 @@ int main(int argc, char **argv) free(service); return EXIT_SUCCESS; /* NOTREACHED */ + case 's': + if_started = true; + break; + case 'S': + if_stopped = true; + break; case 'Z': setenv("IN_DRYRUN", "yes", 1); break; @@ -148,6 +158,10 @@ int main(int argc, char **argv) return 0; if (if_notstarted && (state & RC_SERVICE_STARTED)) return 0; + if (if_started && ! (state & RC_SERVICE_STARTED)) + return 0; + if (if_stopped && ! (state & RC_SERVICE_STOPPED)) + return 0; *argv = service; execv(*argv, argv); eerrorx("%s: %s", applet, strerror(errno));
[gentoo-commits] proj/openrc:master commit in: src/rc/, man/
commit: a2447dfb420cbd97a65cc085404c031d42cb3dfb Author: William Hubbs gmail com> AuthorDate: Mon Dec 4 23:17:17 2017 + Commit: William Hubbs gentoo org> CommitDate: Mon Dec 4 23:17:17 2017 + URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=a2447dfb rc-service: add --ifcrashed option This works like the other --if options. If the service is crashed, run the command. This fixes #154. man/rc-service.8| 4 src/rc/rc-service.c | 10 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/man/rc-service.8 b/man/rc-service.8 index 80deb5eb..8f075de4 100644 --- a/man/rc-service.8 +++ b/man/rc-service.8 @@ -16,6 +16,10 @@ .Nd locate and run an OpenRC service with the given arguments .Sh SYNOPSIS .Nm +.Op Fl c , -ifcrashed +.Ar service cmd +.Op Ar ... +.Nm .Op Fl i , -ifexists .Ar service cmd .Op Ar ... diff --git a/src/rc/rc-service.c b/src/rc/rc-service.c index d0a64999..8e7b00dc 100644 --- a/src/rc/rc-service.c +++ b/src/rc/rc-service.c @@ -29,9 +29,10 @@ const char *applet = NULL; const char *extraopts = NULL; -const char *getoptstring = "e:ilr:IN" getoptstring_COMMON; +const char *getoptstring = "ce:ilr:IN" getoptstring_COMMON; const struct option longopts[] = { { "exists", 1, NULL, 'e' }, + { "ifcrashed", 0, NULL, 'c' }, { "ifexists", 0, NULL, 'i' }, { "ifinactive", 0, NULL, 'I' }, { "ifnotstarted", 0, NULL, 'N' }, @@ -41,6 +42,7 @@ const struct option longopts[] = { }; const char * const longopts_help[] = { "tests if the service exists or not", + "if the service is crashed then run the command", "if the service exists then run the command", "if the service is inactive then run the command", "if the service is not started then run the command", @@ -61,6 +63,7 @@ int main(int argc, char **argv) RC_STRINGLIST *list; RC_STRING *s; RC_SERVICE state; + bool if_crashed = false; bool if_exists = false; bool if_inactive = false; bool if_notstarted = false; @@ -79,6 +82,9 @@ int main(int argc, char **argv) free(service); return opt; /* NOTREACHED */ + case 'c': + if_crashed = true; + break; case 'i': if_exists = true; break; @@ -121,6 +127,8 @@ int main(int argc, char **argv) eerrorx("%s: service `%s' does not exist", applet, *argv); } state = rc_service_state(*argv); + if (if_crashed && ! (rc_service_daemons_crashed(*argv) && errno != EACCES)) + return 0; if (if_inactive && ! (state & RC_SERVICE_INACTIVE)) return 0; if (if_notstarted && (state & RC_SERVICE_STARTED))
[gentoo-commits] proj/openrc:master commit in: src/rc/, man/
commit: 695be59083cdf0d2ff9296f2c210e591c51bdf40 Author: William Hubbs gmail com> AuthorDate: Fri Jul 15 16:37:54 2016 + Commit: William Hubbs gentoo org> CommitDate: Mon Jul 18 18:20:56 2016 + URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=695be590 rc-status: add -m/--manual option to show manually started services X-Gentoo-Bug: 585906 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=585906 man/rc-status.8| 2 ++ src/rc/rc-status.c | 27 +-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/man/rc-status.8 b/man/rc-status.8 index 05d6eee..3b33df4 100644 --- a/man/rc-status.8 +++ b/man/rc-status.8 @@ -33,6 +33,8 @@ Show all runlevels and their services. List all services that have crashed. .It Fl l , -list List all defined runlevels. +.It Fl m , -manual +Show all manually started services. .It Fl r , -runlevel Print the current runlevel name. .It Fl s , -servicelist diff --git a/src/rc/rc-status.c b/src/rc/rc-status.c index 6724db8..8a591db 100644 --- a/src/rc/rc-status.c +++ b/src/rc/rc-status.c @@ -29,11 +29,12 @@ const char *applet = NULL; const char *extraopts = NULL; -const char *getoptstring = "aclrsu" getoptstring_COMMON; +const char *getoptstring = "aclmrsu" getoptstring_COMMON; const struct option longopts[] = { {"all", 0, NULL, 'a'}, {"crashed", 0, NULL, 'c'}, {"list",0, NULL, 'l'}, + {"manual",0, NULL, 'm'}, {"runlevel",0, NULL, 'r'}, {"servicelist", 0, NULL, 's'}, {"unused", 0, NULL, 'u'}, @@ -43,6 +44,7 @@ const char * const longopts_help[] = { "Show services from all run levels", "Show crashed services", "Show list of run levels", + "Show manually started services", "Show the name of the current runlevel", "Show service list", "Show services not assigned to any runlevel", @@ -50,7 +52,7 @@ const char * const longopts_help[] = { }; const char *usagestring = "" \ "Usage: rc-status [options] ...\n"\ - " or: rc-status [options] [-a | -c | -l | -r | -s | -u]"; + " or: rc-status [options] [-a | -c | -l | -m | -r | -s | -u]"; static bool test_crashed = false; static RC_DEPTREE *deptree; @@ -205,6 +207,27 @@ int main(int argc, char **argv) TAILQ_FOREACH(l, levels, entries) printf("%s\n", l->value); goto exit; + case 'm': + services = rc_services_in_runlevel(NULL); + levels = rc_runlevel_list(); + TAILQ_FOREACH_SAFE(s, services, entries, t) { + TAILQ_FOREACH(l, levels, entries) + if (rc_service_in_runlevel(s->value, l->value)) { + TAILQ_REMOVE(services, s, entries); + free(s->value); + free(s); + break; + } + } + TAILQ_FOREACH_SAFE(s, services, entries, t) + if (rc_service_state(s->value) & + (RC_SERVICE_STOPPED | RC_SERVICE_HOTPLUGGED)) { + TAILQ_REMOVE(services, s, entries); + free(s->value); + free(s); + } + print_services(NULL, services); + goto exit; case 'r': runlevel = rc_runlevel_get(); printf("%s\n", runlevel);
[gentoo-commits] proj/openrc:master commit in: src/rc/, /, man/, sh/
commit: 62410eaf4ba92516a58a550717d7f3faf63bb79f Author: William Hubbs gmail com> AuthorDate: Mon Feb 1 18:42:58 2016 + Commit: William Hubbs gentoo org> CommitDate: Wed Apr 27 16:13:50 2016 + URL:https://gitweb.gentoo.org/proj/openrc.git/commit/?id=62410eaf add daemon supervisor The supervise-daemon process is meant to be a lightweight supervisor which can monitor and restart a daemon if it crashes. man/Makefile | 2 +- man/openrc-run.8 | 21 +- man/supervise-daemon.8| 142 + sh/Makefile | 3 +- sh/openrc-run.sh.in | 4 + sh/supervise-daemon.sh| 49 src/rc/.gitignore | 1 + src/rc/Makefile | 8 +- src/rc/supervise-daemon.c | 722 ++ supervise-daemon-guide.md | 45 +++ 10 files changed, 990 insertions(+), 7 deletions(-) diff --git a/man/Makefile b/man/Makefile index 73db2a8..48c5842 100644 --- a/man/Makefile +++ b/man/Makefile @@ -6,7 +6,7 @@ MAN3= einfo.3 \ rc_config.3 rc_deptree.3 rc_find_pids.3 rc_plugin_hook.3 \ rc_runlevel.3 rc_service.3 rc_stringlist.3 MAN8= rc-service.8 rc-status.8 rc-update.8 openrc.8 openrc-run.8 \ - service.8 start-stop-daemon.8 + service.8 start-stop-daemon.8 supervise-daemon.8 ifeq (${OS},Linux) MAN8 += rc-sstat.8 diff --git a/man/openrc-run.8 b/man/openrc-run.8 index b23c5fe..be15d59 100644 --- a/man/openrc-run.8 +++ b/man/openrc-run.8 @@ -95,10 +95,17 @@ String describing the service. .It Ar description_$command String describing the extra command. .It Ar supervisor -Supervisor to use to monitor this daemon. If this is unset, -start-stop-daemon will be used. The only alternate supervisor we support -in this release is S6 from Skarnet software. To use this, set +Supervisor to use to monitor this daemon. If this is unset or invalid, +start-stop-daemon will be used. +Currently, we support s6 from scarnet software, and supervise-daemon +which is a light-weight supervisor internal to OpenRC. +To use s6, set supervisor=s6. +or set +supervisor=supervise-daemon +to use supervise-daemon. +Note that supervise-daemon is still in early development, so it is +considered experimental. .It Ar s6_service_path The path to the s6 service directory if you are monitoring this service with S6. The default is /var/svc.d/${RC_SVCNAME}. @@ -112,10 +119,16 @@ List of arguments passed to start-stop-daemon when starting the daemon. .It Ar command Daemon to start or stop via .Nm start-stop-daemon +or +.Nm supervise-daemon if no start or stop function is defined by the service. .It Ar command_args List of arguments to pass to the daemon when starting via .Nm start-stop-daemon . +.It Ar command_args_foreground +List of arguments to pass to the daemon when starting via +.Nm supervise-daemon . +to force the daemon to stay in the foreground .It Ar command_background Set this to "true", "yes" or "1" (case-insensitive) to force the daemon into the background. This implies the "--make-pidfile" and "--pidfile" option of @@ -123,6 +136,8 @@ the background. This implies the "--make-pidfile" and "--pidfile" option of so the pidfile variable must be set. .It Ar chroot .Xr start-stop-daemon 8 +and +.Xr supervise-daemon 8 will chroot into this path before writing the pid file or starting the daemon. .It Ar pidfile Pidfile to use for the above defined command. diff --git a/man/supervise-daemon.8 b/man/supervise-daemon.8 new file mode 100644 index 000..0608767 --- /dev/null +++ b/man/supervise-daemon.8 @@ -0,0 +1,142 @@ +.\" Copyright (c) 2007-2015 The OpenRC Authors. +.\" See the Authors file at the top-level directory of this distribution and +.\" https://github.com/OpenRC/openrc/blob/master/AUTHORS +.\" +.\" This file is part of OpenRC. It is subject to the license terms in +.\" the LICENSE file found in the top-level directory of this +.\" distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE +.\" This file may not be copied, modified, propagated, or distributed +.\"except according to the terms contained in the LICENSE file. +.\" +.Dd April 27, 2016 +.Dt supervise-DAEMON 8 SMM +.Os OpenRC +.Sh NAME +.Nm supervise-daemon +.Nd starts a daemon and restarts it if it crashes +.Sh SYNOPSIS +.Nm +.Fl d , -chdir +.Ar path +.Fl e , -env +.Ar var=value +.Fl g , -group +.Ar group +.Fl I , -ionice +.Ar arg +.Fl k , -umask +.Ar value +.Fl N , -nicelevel +.Ar level +.Fl p , -pidfile +.Ar pidfile +.Fl u , -user +.Ar user +.Fl r , -chroot +.Ar chrootpath +.Fl 1 , -stdout +.Ar logfile +.Fl 2 , -stderr +.Ar logfile +.Fl S , -start +.Ar daemon +.Op Fl - +.Op Ar arguments +.Nm +.Fl K , -stop +.Ar daemon +.Fl p , -pidfile +.Ar pidfile +.Fl r , -chroot +.Ar chrootpath +.Sh DESCRIPTION +.Nm +provides a consistent method of starting, stopping and restarting +daemons. If +.Fl K , -stop +is not provided, then we assume we are