feat: parallel actions
This commit is contained in:
parent
efb4094d13
commit
099fa7ceab
@ -106,6 +106,7 @@ function ban_ID3 () # $1: ID3
|
|||||||
ID3="$1"
|
ID3="$1"
|
||||||
for Instance in $(show_instances)
|
for Instance in $(show_instances)
|
||||||
do
|
do
|
||||||
|
(
|
||||||
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
|
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
|
||||||
local BanStr="(Uid=(A=$ID3,B=$StrangeConstUID))"
|
local BanStr="(Uid=(A=$ID3,B=$StrangeConstUID))"
|
||||||
local Service=$(service_name "$Instance")
|
local Service=$(service_name "$Instance")
|
||||||
@ -121,7 +122,9 @@ function ban_ID3 () # $1: ID3
|
|||||||
multini -a "$Config" "Engine.AccessControl" "BannedIDs" "$BanStr"
|
multini -a "$Config" "Engine.AccessControl" "BannedIDs" "$BanStr"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
) &
|
||||||
done
|
done
|
||||||
|
wait
|
||||||
}
|
}
|
||||||
|
|
||||||
function unban_ID3 () # $1: ID3
|
function unban_ID3 () # $1: ID3
|
||||||
@ -132,6 +135,7 @@ function unban_ID3 () # $1: ID3
|
|||||||
ID3="$1"
|
ID3="$1"
|
||||||
for Instance in $(show_instances)
|
for Instance in $(show_instances)
|
||||||
do
|
do
|
||||||
|
(
|
||||||
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
|
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
|
||||||
local BanStr="(Uid=(A=$ID3,B=$StrangeConstUID))"
|
local BanStr="(Uid=(A=$ID3,B=$StrangeConstUID))"
|
||||||
local Service=$(service_name "$Instance")
|
local Service=$(service_name "$Instance")
|
||||||
@ -156,6 +160,8 @@ function unban_ID3 () # $1: ID3
|
|||||||
multini -d "$Config" "Engine.AccessControl" "BannedIDs" "$BanStr"
|
multini -d "$Config" "Engine.AccessControl" "BannedIDs" "$BanStr"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
) &
|
||||||
done
|
done
|
||||||
|
wait
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,6 +145,7 @@ function instance_chat ()
|
|||||||
|
|
||||||
for Instance in $InstanceList
|
for Instance in $InstanceList
|
||||||
do
|
do
|
||||||
|
(
|
||||||
if instance_exists "$Instance"; then
|
if instance_exists "$Instance"; then
|
||||||
local Service=$(service_name "$Instance")
|
local Service=$(service_name "$Instance")
|
||||||
if systemctl -q is-active $Service ; then
|
if systemctl -q is-active $Service ; then
|
||||||
@ -159,7 +160,9 @@ function instance_chat ()
|
|||||||
else
|
else
|
||||||
echo "Instance $Instance not exitst"
|
echo "Instance $Instance not exitst"
|
||||||
fi
|
fi
|
||||||
|
) &
|
||||||
done
|
done
|
||||||
|
wait
|
||||||
}
|
}
|
||||||
|
|
||||||
function instance_delete () # $*: [InstanceName[s]]
|
function instance_delete () # $*: [InstanceName[s]]
|
||||||
@ -171,13 +174,16 @@ function instance_delete () # $*: [InstanceName[s]]
|
|||||||
if [[ "$Answ" == "y" || "$Answ" == "Y" ]]; then
|
if [[ "$Answ" == "y" || "$Answ" == "Y" ]]; then
|
||||||
for Instance in $(show_instances)
|
for Instance in $(show_instances)
|
||||||
do
|
do
|
||||||
|
(
|
||||||
instance_stop "$Instance"
|
instance_stop "$Instance"
|
||||||
instance_delete "$Instance"
|
instance_delete "$Instance"
|
||||||
|
) &
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
for Instance in $*
|
for Instance in $*
|
||||||
do
|
do
|
||||||
|
(
|
||||||
if instance_exists "$Instance"; then
|
if instance_exists "$Instance"; then
|
||||||
local InstanceDir="$InstanceConfigDir/$Instance"
|
local InstanceDir="$InstanceConfigDir/$Instance"
|
||||||
instance_stop "$Instance"
|
instance_stop "$Instance"
|
||||||
@ -186,8 +192,10 @@ function instance_delete () # $*: [InstanceName[s]]
|
|||||||
else
|
else
|
||||||
echo "Instance $Instance not exists"
|
echo "Instance $Instance not exists"
|
||||||
fi
|
fi
|
||||||
|
) &
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
wait
|
||||||
}
|
}
|
||||||
|
|
||||||
function instance_disable () # $*: [InstanceName[s]]
|
function instance_disable () # $*: [InstanceName[s]]
|
||||||
|
@ -32,6 +32,7 @@ function maprotate_load () # $*: Instance[s]
|
|||||||
|
|
||||||
for Instance in $InstanceList
|
for Instance in $InstanceList
|
||||||
do
|
do
|
||||||
|
(
|
||||||
local Service=$(service_name "$Instance")
|
local Service=$(service_name "$Instance")
|
||||||
local MapRotate="$InstanceConfigDir/$Instance/MapRotate.ini"
|
local MapRotate="$InstanceConfigDir/$Instance/MapRotate.ini"
|
||||||
if ! instance_exists "$Instance"; then
|
if ! instance_exists "$Instance"; then
|
||||||
@ -69,7 +70,9 @@ function maprotate_load () # $*: Instance[s]
|
|||||||
sed -i --follow-symlinks -r "/(ActiveMapCycle=|GameMapCycles=)/d" "$Config"
|
sed -i --follow-symlinks -r "/(ActiveMapCycle=|GameMapCycles=)/d" "$Config"
|
||||||
sed -i --follow-symlinks "/\[KFGame\.KFGameInfo\]/ r $MapRotate" "$Config"
|
sed -i --follow-symlinks "/\[KFGame\.KFGameInfo\]/ r $MapRotate" "$Config"
|
||||||
fi
|
fi
|
||||||
|
) &
|
||||||
done
|
done
|
||||||
|
wait
|
||||||
}
|
}
|
||||||
|
|
||||||
function maprotate_save () # $*: Instance[s]
|
function maprotate_save () # $*: Instance[s]
|
||||||
|
@ -37,6 +37,7 @@ function password_game () # $1: Password (if empty, use: ''), $*: Instance[s]
|
|||||||
|
|
||||||
for Instance in $InstanceList
|
for Instance in $InstanceList
|
||||||
do
|
do
|
||||||
|
(
|
||||||
if instance_exists "$Instance"; then
|
if instance_exists "$Instance"; then
|
||||||
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
|
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
|
||||||
local Service=$(service_name "$Instance")
|
local Service=$(service_name "$Instance")
|
||||||
@ -52,7 +53,9 @@ function password_game () # $1: Password (if empty, use: ''), $*: Instance[s]
|
|||||||
else
|
else
|
||||||
echo "Instance $Instance not exitst"
|
echo "Instance $Instance not exitst"
|
||||||
fi
|
fi
|
||||||
|
) &
|
||||||
done
|
done
|
||||||
|
wait
|
||||||
}
|
}
|
||||||
|
|
||||||
function password_admin () # $1: Password (if empty, use: ''), $*: Instance[s]
|
function password_admin () # $1: Password (if empty, use: ''), $*: Instance[s]
|
||||||
@ -73,6 +76,7 @@ function password_admin () # $1: Password (if empty, use: ''), $*: Instance[s]
|
|||||||
|
|
||||||
for Instance in $InstanceList
|
for Instance in $InstanceList
|
||||||
do
|
do
|
||||||
|
(
|
||||||
if instance_exists "$Instance"; then
|
if instance_exists "$Instance"; then
|
||||||
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
|
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
|
||||||
local Service=$(service_name "$Instance")
|
local Service=$(service_name "$Instance")
|
||||||
@ -88,6 +92,8 @@ function password_admin () # $1: Password (if empty, use: ''), $*: Instance[s]
|
|||||||
else
|
else
|
||||||
echo "Instance $Instance not exitst"
|
echo "Instance $Instance not exitst"
|
||||||
fi
|
fi
|
||||||
|
) &
|
||||||
done
|
done
|
||||||
|
wait
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,6 +90,7 @@ function workshop_add () # $*: WorkshopID[s]
|
|||||||
|
|
||||||
for Instance in $(show_instances)
|
for Instance in $(show_instances)
|
||||||
do
|
do
|
||||||
|
(
|
||||||
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFEngine.ini"
|
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFEngine.ini"
|
||||||
multini -ar "$Config" "IpDrv.TcpNetDriver" "DownloadManagers" "OnlineSubsystemSteamworks.SteamWorkshopDownload"
|
multini -ar "$Config" "IpDrv.TcpNetDriver" "DownloadManagers" "OnlineSubsystemSteamworks.SteamWorkshopDownload"
|
||||||
for Map in $*
|
for Map in $*
|
||||||
@ -100,7 +101,9 @@ function workshop_add () # $*: WorkshopID[s]
|
|||||||
multini -ar "$Config" "OnlineSubsystemSteamworks.KFWorkshopSteamworks" "ServerSubscribedWorkshopItems" "$WorkshopID"
|
multini -ar "$Config" "OnlineSubsystemSteamworks.KFWorkshopSteamworks" "ServerSubscribedWorkshopItems" "$WorkshopID"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
) &
|
||||||
done
|
done
|
||||||
|
wait
|
||||||
}
|
}
|
||||||
|
|
||||||
function workshop_delete () # $*: WorkshopID[s]
|
function workshop_delete () # $*: WorkshopID[s]
|
||||||
@ -117,6 +120,7 @@ function workshop_delete () # $*: WorkshopID[s]
|
|||||||
rm -rf "$Cache" "$Downl"
|
rm -rf "$Cache" "$Downl"
|
||||||
for Instance in $(show_instances)
|
for Instance in $(show_instances)
|
||||||
do
|
do
|
||||||
|
(
|
||||||
local ConfigEngine="$InstanceConfigDir/$Instance/LinuxServer-KFEngine.ini"
|
local ConfigEngine="$InstanceConfigDir/$Instance/LinuxServer-KFEngine.ini"
|
||||||
multini -d "$ConfigEngine" "OnlineSubsystemSteamworks.KFWorkshopSteamworks" "ServerSubscribedWorkshopItems" "$WorkshopID"
|
multini -d "$ConfigEngine" "OnlineSubsystemSteamworks.KFWorkshopSteamworks" "ServerSubscribedWorkshopItems" "$WorkshopID"
|
||||||
if echo "$WsName" | grep -qP '\.kfm$' ; then
|
if echo "$WsName" | grep -qP '\.kfm$' ; then
|
||||||
@ -125,7 +129,9 @@ function workshop_delete () # $*: WorkshopID[s]
|
|||||||
local ConfigGame="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
|
local ConfigGame="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
|
||||||
multini -d "$ConfigGame" "$WsNameShort KFMapSummary"
|
multini -d "$ConfigGame" "$WsNameShort KFMapSummary"
|
||||||
fi
|
fi
|
||||||
|
) &
|
||||||
done
|
done
|
||||||
|
wait
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,6 +144,7 @@ function workshop_sync ()
|
|||||||
# TODO: Make it faster
|
# TODO: Make it faster
|
||||||
for Instance in $(show_instances)
|
for Instance in $(show_instances)
|
||||||
do
|
do
|
||||||
|
(
|
||||||
local Service=$(service_name "$Instance")
|
local Service=$(service_name "$Instance")
|
||||||
if ! instance_exists "$Instance"; then
|
if ! instance_exists "$Instance"; then
|
||||||
echo "Instance $Instance not exitst"
|
echo "Instance $Instance not exitst"
|
||||||
@ -168,6 +175,8 @@ function workshop_sync ()
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
) &
|
||||||
done
|
done
|
||||||
|
wait
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user