nová verze
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
UNIGMA_PHP=""
|
||||
UNIGMA_MEM=""
|
||||
UNIGMA_EXEC=""
|
||||
|
||||
function cmdUnigma() {
|
||||
local podList vhostsList error raw pod phase
|
||||
|
||||
printSection "Unigma"
|
||||
|
||||
run podList error k3sPodListStatus "$olsKube" || { printDanger "Get pods: $error"; return 1; }
|
||||
[[ -n "$podList" ]] || { printDanger "Pods not found"; return 1; }
|
||||
|
||||
# run vhostList error fileList "$olsVhostsPath" d || { printDanger "$error"; return 1; }
|
||||
run vhostList error openlitespeedConfigVhostList || { printDanger "Failed get list of vhosts: $error"; return 1; }
|
||||
while read -r vhost; do
|
||||
run raw error unigmaGetTxt "$vhost" || {
|
||||
printDotText "$vhost" "${fontGray}failed get Unigma data$fontReset";
|
||||
continue
|
||||
}
|
||||
# raw='php=8.1;mem=112M;exec=60'
|
||||
|
||||
unigmaParse "$raw" || {
|
||||
printDotText "$vhost" "$labelFail";
|
||||
printDanger "$error"
|
||||
continue
|
||||
}
|
||||
|
||||
unigmaIniSet "$vhost" "$UNIGMA_MEM" "$UNIGMA_EXEC"
|
||||
case $? in
|
||||
1) printDotText "$vhost" "$labelFail"; printDanger "$error"; continue ;;
|
||||
2)
|
||||
uid=$(domainToUid "$vhost")
|
||||
[[ -n "$uid" ]] || {
|
||||
printDotText "$vhost" "$labelFail";
|
||||
printDanger "Cannot resolve UID for: $vhost";
|
||||
continue;
|
||||
}
|
||||
|
||||
local pod phase
|
||||
while IFS='|' read -r pod phase; do
|
||||
if [[ "$phase" != "Running" ]]; then
|
||||
printDotText " $pod" "$fontRed$phase$fontReset"
|
||||
else
|
||||
runSilent openlitespeedPodExec "$pod" pkill -u "$uid" -x lsphp
|
||||
printDotText " kill$fontBlue lsphp$fontReset processes for $vhost"
|
||||
fi
|
||||
done < <(awk 'NF' <<< "$podList")
|
||||
;;
|
||||
esac
|
||||
|
||||
unigmaPhpSet "$vhost" "$UNIGMA_PHP" || {
|
||||
printDotText "$vhost" "$labelFail";
|
||||
printDanger "$error"
|
||||
continue
|
||||
}
|
||||
|
||||
printDotText "$vhost" "$labelDone";
|
||||
done < <(awk 'NF' <<< "$vhostList")
|
||||
}
|
||||
Reference in New Issue
Block a user