aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/s6_live.html9
-rw-r--r--src/s6-frontend/live.help.txt1
-rw-r--r--src/s6-frontend/live_startstop.c15
3 files changed, 18 insertions, 7 deletions
diff --git a/doc/s6_live.html b/doc/s6_live.html
index 0bb302d..acc0a07 100644
--- a/doc/s6_live.html
+++ b/doc/s6_live.html
@@ -119,7 +119,7 @@ command can wait forever. </dd>
<h4> Interface </h4>
<pre>
- s6 live stop [ -n ] [ -t <em>timeout</em> ] <em>servicenames...</em>
+ s6 live stop [ -n ] [ -c ] [ -t <em>timeout</em> ] <em>servicenames...</em>
</pre>
<ul>
@@ -134,6 +134,13 @@ as well as services that depends on them. </li>
<dt> <tt>-n</tt>, <tt>--dry-run</tt> </dt>
<dd> Only print what would be done; do not actually stop services. </dd>
+<dt> <tt>-c</tt>, <tt>--clean</tt> </dt>
+<dd> If there are services that were <em>pulled</em>, i.e. started
+by way of the dependency engine without being explicitly listed in the
+arguments of an <tt>s6 live start</tt> command (or in the default bundle
+for the services started at boot), and the explicit services that pulled
+them have been stopped, stop the pulled services as well. </dd>
+
<dt> <tt>-t <em>timeout</em></tt>, <tt>--timeout=<em>timeout</em></tt> </dt>
<dd> If the whole change still hasn't completed after <em>timeout</em>
milliseconds, stop waiting and don't attempt to perform the remaining
diff --git a/src/s6-frontend/live.help.txt b/src/s6-frontend/live.help.txt
index 4fb8e95..bc737a2 100644
--- a/src/s6-frontend/live.help.txt
+++ b/src/s6-frontend/live.help.txt
@@ -16,6 +16,7 @@ s6 live status options:
s6 live start, s6 live stop, s6 live restart, s6 live stop-everything options:
-n --dry-run only show what would be done, don't do it
+ -c --clean stop implicitly pulled services as well
-t TIMEOUT --timeout=TIMEOUT if not done after TIMEOUT milliseconds, abort
s6 live install options:
diff --git a/src/s6-frontend/live_startstop.c b/src/s6-frontend/live_startstop.c
index 6a2abd5..f1ebe57 100644
--- a/src/s6-frontend/live_startstop.c
+++ b/src/s6-frontend/live_startstop.c
@@ -20,6 +20,7 @@
enum golb_e
{
GOLB_DRYRUN = 0x01,
+ GOLB_CLEAN = 0x02,
} ;
enum gola_e
@@ -33,6 +34,7 @@ static unsigned int parse_options (char const *const *argv, uint64_t *wgolb, uns
static gol_bool const rgolb[] =
{
{ .so = 'n', .lo = "dry-run", .clear = 0, .set = GOLB_DRYRUN },
+ { .so = 'c', .lo = "clean", .clear = 0, .set = GOLB_CLEAN },
} ;
static gol_arg const rgola[] =
{
@@ -48,12 +50,12 @@ static unsigned int parse_options (char const *const *argv, uint64_t *wgolb, uns
return argc ;
}
-static int run_s6rc_change (char const *const *services, unsigned int n, int h, int dryrun, unsigned int timeout, unsigned int nstate, char const *dbfn)
+static int run_s6rc_change (char const *const *services, unsigned int n, int h, uint64_t flags, unsigned int timeout, unsigned int nstate, char const *dbfn)
{
pid_t pid ;
int wstat ;
unsigned int m = 0 ;
- char const *argv[12 + n] ;
+ char const *argv[13 + n] ;
char fmtv[UINT_FMT] ;
char fmtt[UINT_FMT] ;
unsigned char oldstate[nstate] ;
@@ -71,7 +73,8 @@ static int run_s6rc_change (char const *const *services, unsigned int n, int h,
fmtt[uint_fmt(fmtt, timeout)] = 0 ;
argv[m++] = fmtt ;
}
- if (dryrun) argv[m++] = "-n1" ;
+ if (flags & GOLB_DRYRUN) argv[m++] = "-n1" ;
+ if (flags & GOLB_CLEAN) argv[m++] = "-c" ;
argv[m++] = "-l" ;
argv[m++] = g->dirs.live ;
argv[m++] = "--" ;
@@ -111,7 +114,7 @@ static int live_startstop (char const *const *argv, int h)
if (!s6rc_live_state_size(g->dirs.live, &nlong, &nshort))
strerr_diefu2sys(111, "read state size in ", g->dirs.live) ;
- return run_s6rc_change(argv, env_len(argv), h, !!(wgolb & GOLB_DRYRUN), timeout, nlong + nshort, dbfn) ;
+ return run_s6rc_change(argv, env_len(argv), h, wgolb, timeout, nlong + nshort, dbfn) ;
}
void live_start (char const *const *argv)
@@ -146,8 +149,8 @@ void live_restart (char const *const *argv)
if (!s6rc_live_state_size(g->dirs.live, &nlong, &nshort))
strerr_diefu2sys(111, "read state size in ", g->dirs.live) ;
- e = run_s6rc_change(argv, argc, 0, !!(wgolb & GOLB_DRYRUN), timeout, nlong + nshort, dbfn) ;
+ e = run_s6rc_change(argv, argc, 0, wgolb, timeout, nlong + nshort, dbfn) ;
if (e) _exit(e) ;
- e = run_s6rc_change(argv, argc, 1, !!(wgolb & GOLB_DRYRUN), timeout, nlong + nshort, dbfn) ;
+ e = run_s6rc_change(argv, argc, 1, wgolb, timeout, nlong + nshort, dbfn) ;
_exit(e) ;
}