On Thu, Oct 29, 2020 at 06:32:36PM +0800, Liu Yinsi wrote:
[why] some containers have start-depends, docker start "${containers[@]}" also cause container service resume failed, need start its dependence firstly. [how] before: 4-docker/buildall => execute $CONTAINER/build, install, first-run, start script
after: 4-docker/buildall reboot => only execute $CONTAINER/first-run, start script
About how: [how] should explain how to implement this function. so how about the follow:
[How] 1. add param(action) to buildall script. 2. if first deploy cci, $action is none, buildall script will execute: - $CONTAINER/build; - $CONTAINER/install; - $CONTAINER/first-run; - $CONTAINER/start script. 3. if reboot, $action will be 'reboot', buildall script will execute: - $CONTAINER/first-run; - $CONTAINER/start script.
build_depends() { @@ -30,8 +31,10 @@ do_one() ( cd $container [ "$container_name" == 'sub-fluentd' ] && exit
[ -x build ] && ./build
[ -x install ] && ./install
if [ "$action" != "reboot" ]; then
[ -x build ] && ./build
[ -x install ] && ./install
fi
if just judge one case, how about [ xx != xx ] && ...
diff --git a/sparrow/7-systemd/cci-network b/sparrow/7-systemd/cci-network index 4aadcdc..6e59dbb 100755 --- a/sparrow/7-systemd/cci-network +++ b/sparrow/7-systemd/cci-network @@ -4,7 +4,8 @@ #this file used in our own systemd unit file: cci-network.service. #contents as follows will be automatically executed after system reboot.
-[[ $CCI_SRC ]] || CCI_SRC=/c/compass-ci
+# export ENV
delete this line?
-------- Thanks Yu Chuan
+. /etc/profile.d/compass.sh
$CCI_SRC/sparrow/2-network/br0 $CCI_SRC/sparrow/2-network/iptables @@ -12,5 +13,5 @@ $CCI_SRC/sparrow/2-network/nfs $CCI_SRC/sparrow/2-network/cifs
# --restart=always option is not absolutely reliable -containers=($(docker ps -a |grep -v NAMES |awk '{print $NF}')) -[ -n "$containers" ] && docker start "${containers[@]}" >/dev/null 2>&1 +# container need to start its dependences firstly.
+$CCI_SRC/sparrow/4-docker/buildall reboot
2.23.0