Nathan Scott <nathans@xxxxxxxxxx> writes:
> Nathan Scott (6):
> docker: switch to using Marks env var suggestion
> [...]
By the way, have y'all considered using the daemons in foreground mode
("pmcd -f" et al.) as the contained pid-1 process, instead of
inventions such as pmsleep? Something like the patches below
[1] or even [2] (untested!).
Beyond removing an unnecessary part, another benefit would be that the
container pid-1 would actually exit when the daemon does, so that the
orchestrator could possibly restart the thing.
- FChE
[1]
diff --git a/src/pmcd/rc_pmcd b/src/pmcd/rc_pmcd
index 635919ac8484..83edfef108d8 100644
--- a/src/pmcd/rc_pmcd
+++ b/src/pmcd/rc_pmcd
@@ -484,7 +484,11 @@ Error: pmcd control file '"$PCP_PMCDCONF_PATH"' is
missing, cannot start pmcd.'
-e 's/ $//' \
| tr '\012' ' ' `
- $PMCD $OPTS
+ if [ -z "$PCP_CONTAINER_IMAGE" ]; then
+ $PMCD $OPTS
+ else
+ $PMCD -f $OPTS &
+ fi
_start_pmcheck
$RC_STATUS -v
@@ -502,7 +506,7 @@ Error: pmcd control file '"$PCP_PMCDCONF_PATH"' is missing,
cannot start pmcd.'
[ -x $PCPLOCAL ] && $PCPLOCAL $VFLAG start
# finally, stop here if running in a container
- [ -z "$PCP_CONTAINER_IMAGE" ] || exec $PCP_BINADM_DIR/pmpause
+ [ -z "$PCP_CONTAINER_IMAGE" ] || wait
fi
status=0
;;
[2]
diff --git a/src/pmcd/rc_pmcd b/src/pmcd/rc_pmcd
index 635919ac8484..d56a89d6928c 100644
--- a/src/pmcd/rc_pmcd
+++ b/src/pmcd/rc_pmcd
@@ -484,7 +484,7 @@ Error: pmcd control file '"$PCP_PMCDCONF_PATH"' is missing,
cannot start pmcd.'
-e 's/ $//' \
| tr '\012' ' ' `
- $PMCD $OPTS
+ ( # start this in background, in anticipation of pmcd start
_start_pmcheck
$RC_STATUS -v
@@ -500,9 +500,14 @@ Error: pmcd control file '"$PCP_PMCDCONF_PATH"' is
missing, cannot start pmcd.'
# site-local customisations after PMCD startup
[ -x $PCPLOCAL ] && $PCPLOCAL $VFLAG start
-
- # finally, stop here if running in a container
- [ -z "$PCP_CONTAINER_IMAGE" ] || exec $PCP_BINADM_DIR/pmpause
+ ) &
+
+ if [ -n "$PCP_CONTAINER_IMAGE" ]; then
+ exec $PMCD -f $OPTS # stay in foreground
+ else
+ $PMCD $OPTS
+ wait # for subshell
+ fi
fi
status=0
;;
|