jina verze

This commit is contained in:
2026-08-12 10:53:04 +02:00
parent f186ec26a8
commit 93d4f24f07
43 changed files with 1686 additions and 1959 deletions
+54 -54
View File
@@ -9,10 +9,10 @@ siteWordpressLabel="[Wordpress]"
function cmdSiteAdd() {
local domain sourceFiles
domain=$(domainPrepare "$1")
shift || true
shift
sourceFiles="${1:-$appAssetsPath/vhost/default}"
shift || true
shift
printSection "Add site"
printDotText "domain" "$domain"
@@ -36,10 +36,10 @@ function cmdSiteAdd() {
function cmdSiteRemove() {
local domain mode
domain=$(domainPrepare "$1")
shift || true
shift
mode="$1"
shift || true
shift
if [[ ! "$mode" == "-f" && ! "$mode" == "--force" ]]; then
if ! cmdRouterConfirm "Are you sure you want to$fontRed DELETE$fontReset the site $fontBlue$domain$fontReset?"; then
@@ -141,13 +141,13 @@ function cmdSiteRename() {
function cmdSiteAddWordpress() {
local domain sourceFiles
domain=$(domainPrepare "$1")
shift || true
shift
sourceFiles="${1:-$appAssetsPath/vhost/wordpress}"
if [[ ! -e "$sourceFiles" ]]; then
sourceFiles="$appAssetsPath/vhost/wordpress.tar.gz"
fi
shift || true
shift
printSection "Add site (Wordpress)"
printDotText "domain" "$domain"
@@ -185,7 +185,7 @@ function cmdSiteConfigRebuild() {
printDotText "OLS vhost" "$labelDone"
fi
if ! runError error openlitespeedConfigVhostSet "$domain"; then
if ! runError error openlitespeedConfigRebuild "$domain"; then
printDotText "OLS config" "$labelFail"
printDanger "$error"
else
@@ -247,7 +247,7 @@ function cmdSitePasswordReset() {
if [[ -z "$target" ]]; then
printDanger "Target not specified";
elif ! run vhostList error openlitespeedConfigVhostList; then
elif ! run vhostList error openlitespeedVhostList; then
printDanger "Cannot get vhost list: $error";
elif [[ "$target" == "all" ]]; then
local domain
@@ -280,7 +280,7 @@ function cmdSiteAuthReset() {
if [[ -z "$target" ]]; then
printDanger "Target not specified";
elif ! run vhostList error openlitespeedConfigVhostList; then
elif ! run vhostList error openlitespeedVhostList; then
printDanger "Cannot get vhost list: $error";
elif [[ "$target" == "all" ]]; then
local domain
@@ -375,7 +375,7 @@ function cmdSiteInfo() {
fi
local limits blockLimit inodeLimit
if ! run limits error openlitespeedVhostQuotaGet "$ug"; then
if ! run limits error openlitespeedVhostQuota "$ug"; then
printDotText "quota block limit" "$labelUnknown"
printDotText "quota inode limit" "$labelUnknown"
else
@@ -410,25 +410,25 @@ function cmdSiteInfo() {
fi
printSection "OpenLiteSpeed"
if [[ ! -f "$olsVhostsConfigPath/$domain.conf" ]]; then
printDotText "file$fontReset" "$fontRed$olsVhostsConfigPath/$domain.conf$fontReset"
if [[ ! -f "$openlitespeedVhostsPath/$domain.conf" ]]; then
printDotText "file$fontReset" "$fontRed$openlitespeedVhostsPath/$domain.conf$fontReset"
printDotText "file$fontReset" "${fontRed}not found$fontReset"
else
printDotText "file$fontReset" "$fontGreen$olsVhostsConfigPath/$domain.conf$fontReset"
printDotText "file$fontReset" "$fontGreen$openlitespeedVhostsPath/$domain.conf$fontReset"
fi
if [[ ! -d "$olsVhostsPath/$domain" ]]; then
printDotText "path$fontReset" "$fontRed$olsVhostsPath/$domain$fontReset"
if [[ ! -d "$vhostsPath/$domain" ]]; then
printDotText "path$fontReset" "$fontRed$vhostsPath/$domain$fontReset"
printDotText "path$fontReset" "${fontRed}not found$fontReset"
else
printDotText "path$fontReset" "$fontGreen$olsVhostsPath/$domain$fontReset"
printDotText "path$fontReset" "$fontGreen$vhostsPath/$domain$fontReset"
fi
if [[ ! -d "$olsPrivatePath/$domain" ]]; then
printDotText "data$fontReset" "$fontRed$olsPrivatePath/$domain$fontReset"
if [[ ! -d "$openlitespeedVhostDataPath/$domain" ]]; then
printDotText "data$fontReset" "$fontRed$openlitespeedVhostDataPath/$domain$fontReset"
printDotText "data$fontReset" "${fontRed}not found$fontReset"
else
printDotText "data$fontReset" "$fontGreen$olsPrivatePath/$domain$fontReset"
printDotText "data$fontReset" "$fontGreen$openlitespeedVhostDataPath/$domain$fontReset"
fi
}
@@ -489,7 +489,7 @@ function cmdSiteStatus() {
fi
local limits blockLimit inodeLimit
if ! run limits error openlitespeedVhostQuotaGet "$ug"; then
if ! run limits error openlitespeedVhostQuota "$ug"; then
printDotText "quota block limit" "$labelFail"
printDotText "quota inode limit" "$labelFail"
else
@@ -519,7 +519,7 @@ function cmdSiteStatus() {
printSection "Path | existence, owner, permissions, ACL:nobody"
local path
path="$olsVhostsPath/$domain"
path="$vhostsPath/$domain"
label="vhost $fontBlue/$fontReset"
note="${fontGray}755:root:root$fontReset"
if [[ ! -d "$path" ]]; then
@@ -530,7 +530,7 @@ function cmdSiteStatus() {
printDotText "$label" "$note $labelPass"
fi
path="$olsVhostsPath/$domain/www"
path="$vhostsPath/$domain/www"
label="vhost $fontBlue/www$fontReset"
note="${fontGray}2750:u:g acl:r-x$fontReset"
if [[ ! -d "$path" ]]; then
@@ -547,7 +547,7 @@ function cmdSiteStatus() {
local dir
dirs=(session tmp)
for dir in "${dirs[@]}"; do
path="$olsVhostsPath/$domain/$dir"
path="$vhostsPath/$domain/$dir"
label="vhost $fontBlue/$dir$fontReset"
note="${fontGray}770:u:g acl:rwx$fontReset"
if [[ ! -d "$path" ]]; then
@@ -561,7 +561,7 @@ function cmdSiteStatus() {
fi
done
path="$olsPrivatePath/$domain"
path="$openlitespeedVhostDataPath/$domain"
label="vhost-data $fontBlue/$fontReset"
note="${fontGray}750:u:g acl:r-x$fontReset"
if [[ ! -d "$path" ]]; then
@@ -574,7 +574,7 @@ function cmdSiteStatus() {
printDotText "$label" "$note $labelPass"
fi
path="$olsPrivatePath/$domain/bootstrap.php"
path="$openlitespeedVhostDataPath/$domain/bootstrap.php"
label="vhost-data $fontBlue/bootstrap.php$fontReset"
note="${fontGray}600:u:g acl:r--$fontReset"
if [[ ! -f "$path" ]]; then
@@ -589,7 +589,7 @@ function cmdSiteStatus() {
# fileSignatureAclDiff "$path" "user:nobody:r--"
printSection "OpenLiteSpeed"
if ! run vhostList error openlitespeedConfigVhostList; then
if ! run vhostList error openlitespeedVhostList; then
printDotText "get vhost list" "$labelFail"
else
note="$fontGray$domain$fontReset"
@@ -600,7 +600,7 @@ function cmdSiteStatus() {
fi
fi
note="$fontGray$domain.conf$fontReset"
if [[ ! -f "$olsVhostsConfigPath/$domain.conf" ]]; then
if [[ ! -f "$openlitespeedVhostsPath/$domain.conf" ]]; then
printDotText "config" "$note $labelFail"
else
printDotText "config" "$note $labelPass"
@@ -715,120 +715,120 @@ function siteFilesCheck() {
ug=$(domainToUser "$domain")
dots=30
# fileSignatureDiff "$olsVhostsPath/$domain" "755:root:root"
if ! run output error fileSignatureDiff "$olsVhostsPath/$domain" "755:root:root"; then
# fileSignatureDiff "$vhostsPath/$domain" "755:root:root"
if ! run output error fileSignatureDiff "$vhostsPath/$domain" "755:root:root"; then
printDanger "${error:-$output}"
elif [[ -n "$output" ]]; then
local prefix=":$olsVhostsPath/$domain"
local prefix=":$vhostsPath/$domain"
printDot "$dots" "${fontCyan}vhost d 755:root:root$fontReset" "" "${output/$prefix/ /}"
fi
# fileSignatureDiffList "$olsVhostsPath/$domain/www" "d" "2750|$ug:$ug"
if ! run output error fileSignatureDiffList "$olsVhostsPath/$domain/www" "d" "2750|$ug:$ug"; then
# fileSignatureDiffList "$vhostsPath/$domain/www" "d" "2750|$ug:$ug"
if ! run output error fileSignatureDiffList "$vhostsPath/$domain/www" "d" "2750|$ug:$ug"; then
printDanger "${error:-$output}"
else
lineCount=$(grep -c . <<< "$output" || true)
if [[ "$lineCount" -gt 0 ]]; then
local label="${fontCyan}www d 2750:u:g$fontReset"
local prefix=":$olsVhostsPath/$domain/www/"
local prefix=":$vhostsPath/$domain/www/"
while read -r line; do
printDot "$dots" "$label" "" "${line/$prefix/ /}"
done < <(awk 'NF' <<< "$output")
fi
fi
# fileSignatureDiffList "$olsVhostsPath/$domain/www" "f" "(600|640):$ug:$ug"
if ! run output error fileSignatureDiffList "$olsVhostsPath/$domain/www" "f" "(600|640):$ug:$ug"; then
# fileSignatureDiffList "$vhostsPath/$domain/www" "f" "(600|640):$ug:$ug"
if ! run output error fileSignatureDiffList "$vhostsPath/$domain/www" "f" "(600|640):$ug:$ug"; then
printDanger "${error:-$output}"
else
lineCount=$(grep -c . <<< "$output" || true)
if [[ "$lineCount" -gt 0 ]]; then
local label="${fontCyan}www f (600|640):u:g$fontReset"
local prefix=":$olsVhostsPath/$domain/www/"
local prefix=":$vhostsPath/$domain/www/"
while read -r line; do
printDot "$dots" "$label" "" "${line/$prefix/ /}"
done < <(awk 'NF' <<< "$output")
fi
fi
# fileSignatureDiffList "$olsVhostsPath/$domain/tmp" "d" "770:$ug:$ug"
if ! run output error fileSignatureDiffList "$olsVhostsPath/$domain/tmp" "d" "770:$ug:$ug"; then
# fileSignatureDiffList "$vhostsPath/$domain/tmp" "d" "770:$ug:$ug"
if ! run output error fileSignatureDiffList "$vhostsPath/$domain/tmp" "d" "770:$ug:$ug"; then
printDanger "${error:-$output}"
else
lineCount=$(grep -c . <<< "$output" || true)
if [[ "$lineCount" -gt 0 ]]; then
local label="${fontCyan}tmp d 770:u:g$fontReset"
local prefix=":$olsVhostsPath/$domain/tmp/"
local prefix=":$vhostsPath/$domain/tmp/"
while read -r line; do
printDot "$dots" "$label" "" "${line/$prefix/ /}"
done < <(awk 'NF' <<< "$output")
fi
fi
# fileSignatureDiffList "$olsVhostsPath/$domain/tmp" "f" "660:$ug:$ug"
if ! run output error fileSignatureDiffList "$olsVhostsPath/$domain/tmp" "f" "660:$ug:$ug"; then
# fileSignatureDiffList "$vhostsPath/$domain/tmp" "f" "660:$ug:$ug"
if ! run output error fileSignatureDiffList "$vhostsPath/$domain/tmp" "f" "660:$ug:$ug"; then
printDanger "${error:-$output}"
else
lineCount=$(grep -c . <<< "$output" || true)
if [[ "$lineCount" -gt 0 ]]; then
local label="${fontCyan}tmp f 660:u:g$fontReset"
local prefix=":$olsVhostsPath/$domain/tmp/"
local prefix=":$vhostsPath/$domain/tmp/"
while read -r line; do
printDot "$dots" "$label" "" "${line/$prefix/ /}"
done < <(awk 'NF' <<< "$output")
fi
fi
# fileSignatureDiffList "$olsVhostsPath/$domain/session" "d" "770:$ug:$ug"
if ! run output error fileSignatureDiffList "$olsVhostsPath/$domain/session" "d" "770:$ug:$ug"; then
# fileSignatureDiffList "$vhostsPath/$domain/session" "d" "770:$ug:$ug"
if ! run output error fileSignatureDiffList "$vhostsPath/$domain/session" "d" "770:$ug:$ug"; then
printDanger "${error:-$output}"
else
lineCount=$(grep -c . <<< "$output" || true)
if [[ "$lineCount" -gt 0 ]]; then
local label="${fontCyan}session d 770:u:g$fontReset"
local prefix=":$olsVhostsPath/$domain/session/"
local prefix=":$vhostsPath/$domain/session/"
while read -r line; do
printDot "$dots" "$label" "" "${line/$prefix/ /}"
done < <(awk 'NF' <<< "$output")
fi
fi
# fileSignatureDiffList "$olsVhostsPath/$domain/session" "f" "(660|600):$ug:$ug"
if ! run output error fileSignatureDiffList "$olsVhostsPath/$domain/session" "f" "(660|600):$ug:$ug"; then
# fileSignatureDiffList "$vhostsPath/$domain/session" "f" "(660|600):$ug:$ug"
if ! run output error fileSignatureDiffList "$vhostsPath/$domain/session" "f" "(660|600):$ug:$ug"; then
printDanger "${error:-$output}"
else
lineCount=$(grep -c . <<< "$output" || true)
if [[ "$lineCount" -gt 0 ]]; then
local label="${fontCyan}session f (660|600):u:g$fontReset"
local prefix=":$olsVhostsPath/$domain/session/"
local prefix=":$vhostsPath/$domain/session/"
while read -r line; do
printDot "$dots" "$label" "" "${line/$prefix/ /}"
done < <(awk 'NF' <<< "$output")
fi
fi
# fileSignatureDiffList "$olsPrivatePath/$domain" "d" "750:$ug:$ug"
if ! run output error fileSignatureDiffList "$olsPrivatePath/$domain" "d" "750:$ug:$ug"; then
# fileSignatureDiffList "$openlitespeedVhostDataPath/$domain" "d" "750:$ug:$ug"
if ! run output error fileSignatureDiffList "$openlitespeedVhostDataPath/$domain" "d" "750:$ug:$ug"; then
printDanger "${error:-$output}"
else
lineCount=$(grep -c . <<< "$output" || true)
if [[ "$lineCount" -gt 0 ]]; then
local label="${fontCyan}data d 750:u:g$fontReset"
local prefix=":$olsPrivatePath/$domain/"
local prefix=":$openlitespeedVhostDataPath/$domain/"
while read -r line; do
printDot "$dots" "$label" "" "${line/$prefix/ /}"
done < <(awk 'NF' <<< "$output")
fi
fi
# fileSignatureDiffList "$olsPrivatePath/$domain" "f" "600:$ug:$ug"
if ! run output error fileSignatureDiffList "$olsPrivatePath/$domain" "f" "600:$ug:$ug"; then
# fileSignatureDiffList "$openlitespeedVhostDataPath/$domain" "f" "600:$ug:$ug"
if ! run output error fileSignatureDiffList "$openlitespeedVhostDataPath/$domain" "f" "600:$ug:$ug"; then
printDanger "${error:-$output}"
else
lineCount=$(grep -c . <<< "$output" || true)
if [[ "$lineCount" -gt 0 ]]; then
local label="${fontCyan}data f 600:u:g$fontReset"
local prefix=":$olsPrivatePath/$domain/"
local prefix=":$openlitespeedVhostDataPath/$domain/"
while read -r line; do
printDot "$dots" "$label" "" "${line/$prefix/ /}"
done < <(awk 'NF' <<< "$output")