feat: parallel actions

This commit is contained in:
2020-08-07 14:20:40 +03:00
parent debe08037e
commit 2198482459
6 changed files with 36 additions and 5 deletions

View File

@ -145,6 +145,7 @@ function instance_chat ()
for Instance in $InstanceList
do
(
if instance_exists "$Instance"; then
local Service=$(service_name "$Instance")
if systemctl -q is-active $Service ; then
@ -159,7 +160,9 @@ function instance_chat ()
else
echo "Instance $Instance not exitst"
fi
) &
done
wait
}
function instance_delete () # $*: [InstanceName[s]]
@ -171,13 +174,16 @@ function instance_delete () # $*: [InstanceName[s]]
if [[ "$Answ" == "y" || "$Answ" == "Y" ]]; then
for Instance in $(show_instances)
do
(
instance_stop "$Instance"
instance_delete "$Instance"
) &
done
fi
else
for Instance in $*
do
do
(
if instance_exists "$Instance"; then
local InstanceDir="$InstanceConfigDir/$Instance"
instance_stop "$Instance"
@ -186,8 +192,10 @@ function instance_delete () # $*: [InstanceName[s]]
else
echo "Instance $Instance not exists"
fi
) &
done
fi
wait
}
function instance_disable () # $*: [InstanceName[s]]