jina verze
This commit is contained in:
@@ -10,7 +10,7 @@ function cmdBackupSitesArchive() {
|
||||
local type="${2:-$backupType}"
|
||||
|
||||
local error vhostList total
|
||||
run vhostList error openlitespeedConfigVhostList || { printDanger "Failed get list of vhosts: $error"; return 1; }
|
||||
run vhostList error openlitespeedVhostList || { printDanger "Failed get list of virtual hosts: $error"; return 1; }
|
||||
total=$(grep -c . <<< "$vhostList")
|
||||
|
||||
printSection "Config"
|
||||
@@ -68,13 +68,13 @@ function cmdBackupSitesRsync() {
|
||||
printDotText "Path" "$path"
|
||||
|
||||
local error vhostList
|
||||
run vhostList error openlitespeedConfigVhostList || { printDanger "Failed get list of vhosts: $error"; return 1; }
|
||||
run vhostList error openlitespeedVhostList || { printDanger "Failed get list of virtual hosts: $error"; return 1; }
|
||||
|
||||
printText "Files..."
|
||||
if [[ "$path" == *"$backupFirstDir" ]]; then
|
||||
runError error rsync -a --mkpath -- "$olsVhostsPath/" "$path" || printDanger "$error"
|
||||
runError error rsync -a --mkpath -- "$vhostsPath/" "$path" || printDanger "$error"
|
||||
else
|
||||
runError error rsync -a --link-dest="$backupDailyPath/$backupFirstDir" -- "$olsVhostsPath/" "$path" || printDanger "$error"
|
||||
runError error rsync -a --link-dest="$backupDailyPath/$backupFirstDir" -- "$vhostsPath/" "$path" || printDanger "$error"
|
||||
fi
|
||||
|
||||
printText "Databases..."
|
||||
@@ -84,7 +84,7 @@ function cmdBackupSitesRsync() {
|
||||
|
||||
printText "Configs..."
|
||||
while read -r domain; do
|
||||
runError error cp -p -- "$olsVhostsConfigPath/$domain.conf" "$path/$domain.conf" || printDanger "$error"
|
||||
runError error cp -p -- "$openlitespeedVhostsPath/$domain.conf" "$path/$domain.conf" || printDanger "$error"
|
||||
done < <(awk 'NF' <<< "$vhostList")
|
||||
}
|
||||
|
||||
@@ -302,7 +302,6 @@ function cmdBackupDispatch() {
|
||||
# [$3] (type): backup type.
|
||||
function cmdBackupRun() {
|
||||
local target="$1"
|
||||
[[ -n "$target" ]] || { printRow; printDanger "Target not specified"; return 1; }
|
||||
|
||||
local path="$2"
|
||||
path=$(backupPathGenerate "$path")
|
||||
@@ -328,56 +327,3 @@ function cmdBackupRun() {
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function cmdBackupList() {
|
||||
printRow
|
||||
|
||||
local dirList archiveList dailyList backupList backupCount error
|
||||
run dirList error fileList "$backupArchivePath" d || { printDanger "$error"; return 1; }
|
||||
archiveList=$(printf '%s\n' "$dirList" | grep -E -- "$backupArchiveDirPattern" | sort || true)
|
||||
|
||||
run dirList error fileList "$backupDailyPath" d || { printDanger "$error"; return 1; }
|
||||
dailyList=$(printf '%s\n' "$dirList" | grep -E -- "$backupDailyDirPattern" | sort || true)
|
||||
|
||||
backupList=$(printf '%s\n' "$archiveList" "$dailyList" | awk 'NF' | sort)
|
||||
backupCount=$(grep -c . <<< "$backupList" || true)
|
||||
local i=0 num dir label
|
||||
while read -r dir; do
|
||||
((++i))
|
||||
num=$(printf "%0${#backupCount}d" "$i")
|
||||
label="$num: $fontBlue$dir$fontReset"
|
||||
|
||||
if listContains "$dir" "$archiveList"; then
|
||||
printDotText "$label" "${fontGreen}archive$fontReset"
|
||||
elif listContains "$dir" "$dailyList"; then
|
||||
printDotText "$label" "${fontGreen}daily$fontReset"
|
||||
else
|
||||
printDotText "$label" "$labelUnknown"
|
||||
fi
|
||||
done < <(awk 'NF' <<< "$backupList")
|
||||
}
|
||||
|
||||
function cmdBackupSize() {
|
||||
local dirList file size total=0 archiveList dailyList
|
||||
|
||||
printSection "Archive: $backupArchivePath"
|
||||
run dirList error fileList "$backupArchivePath" d || { printDanger "$error"; return 1; }
|
||||
archiveList=$(printf '%s\n' "$dirList" | grep -E -- "$backupArchiveDirPattern" | sort || true)
|
||||
while IFS= read -r file; do
|
||||
size=$(pathSize "$backupArchivePath/$file" "gb")
|
||||
printDotText "$file" "$size Gb"
|
||||
(( total += size ))
|
||||
done <<< "$archiveList"
|
||||
|
||||
printSection "Daily: $backupDailyPath"
|
||||
run dirList error fileList "$backupDailyPath" d || { printDanger "$error"; return 1; }
|
||||
dailyList=$(printf '%s\n' "$dirList" | grep -E -- "$backupDailyDirPattern" | sort || true)
|
||||
while IFS= read -r file; do
|
||||
size=$(pathSize "$backupDailyPath/$file" "gb")
|
||||
printDotText "$file" "$size Gb"
|
||||
(( total += size ))
|
||||
done <<< "$dailyList"
|
||||
|
||||
printRow
|
||||
printDotText "total" "$total Gb"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user