local time="$(date +%T)"
local history_path="history"
local typ="none"
+ local history_size=0
[ -f "$backup_path/day" ] && typ="day"
[ -f "$backup_path/week" ] && typ="week"
mkdir --parents "$history_path"
+ [ -f "$history_path/$backup_history_file" ] \
+ && history_size=$(cat $history_path/$backup_history_file \
+ | wc -c)
+ echo "ℹ️ INFO: $history_path/$backup_history_file size $history_size bytes"
+ [ $history_size -ge 1024 ] \
+ && savelog -c 7 -l $history_path/$backup_history_file \
+ && echo "ℹ️ INFO: $history_path/$backup_history_file rotate"
+
echo "ℹ️ INFO: add history $date $time $typ $backup_dir"
echo "$date" > $backup_path/$typ
echo "$date" > $history_path/$typ
command -v ssh > /dev/null \
|| errlog "command ssh not found" \
|| return $?
+ command -v savelog > /dev/null \
+ || errlog "command savelog not found" \
+ || return $?
+ command -v du > /dev/null \
+ || errlog "command du not found" \
+ || return $?
+ command -v wc > /dev/null \
+ || errlog "command wc not found" \
+ || return $?
[ -f "config.yaml" ] \
|| errlog "file config.yaml not found" \
|| return $?