experimental netns support and some fixes

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2020-03-28 19:12:15 +03:00
parent bba7eef3d9
commit c5bbf92022

12
ssm
View File

@ -143,10 +143,12 @@ run_service_action() {
spawn() {
if [[ $service_logfile_out == "$service_logfile_err" ]]; then
exec "$@" >"$service_logfile_out" 2>&1
exec 3>"$service_logfile_out"
else
exec "$@" >"$service_logfile_out" 2>"$service_logfile_err"
exec 3>"$service_logfile_err"
fi
exec "$@" >"$service_logfile_out" 2>&3
}; readonly spawn;
cgroup_get_procs() {
@ -243,7 +245,7 @@ svc() {
# One service failure, two service failures...
if service_success_exit u "$job_exit"; then
job_success = 1
(( fail_counter )) && fail_counter--
(( fail_counter )) && fail_counter=0
else
job_success = 0
fail_counter++
@ -416,6 +418,10 @@ start() {
mktmpfiles || return 13
if [[ $service_netns ]]; then
service_command=( ip netns exec "$service_netns" "${service_command[@]}" )
fi
svc "${service_command[@]}" & job=$!
if service_oneshot; then