fix: fix array problem
This commit is contained in:
+3
-3
@@ -7,7 +7,7 @@ function clear_dir() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function backup_init() {
|
function backup_init() {
|
||||||
NOW=$(date +"${BACKUP_FILE_DATE_FORMAT}")
|
NOW="$(date +"${BACKUP_FILE_DATE_FORMAT}")"
|
||||||
# backup bitwarden_rs database file
|
# backup bitwarden_rs database file
|
||||||
BACKUP_FILE_DB="${BACKUP_DIR}/db.${NOW}.sqlite3"
|
BACKUP_FILE_DB="${BACKUP_DIR}/db.${NOW}.sqlite3"
|
||||||
# backup bitwarden_rs config file
|
# backup bitwarden_rs config file
|
||||||
@@ -32,7 +32,7 @@ function backup_config() {
|
|||||||
color blue "backup bitwarden_rs config"
|
color blue "backup bitwarden_rs config"
|
||||||
|
|
||||||
if [[ -f "${DATA_CONFIG}" ]]; then
|
if [[ -f "${DATA_CONFIG}" ]]; then
|
||||||
cp -f ${DATA_DIR}/config.json ${BACKUP_FILE_CONFIG}
|
cp -f "${DATA_DIR}/config.json" "${BACKUP_FILE_CONFIG}"
|
||||||
else
|
else
|
||||||
color yellow "not found bitwarden_rs config, skipping"
|
color yellow "not found bitwarden_rs config, skipping"
|
||||||
fi
|
fi
|
||||||
@@ -110,7 +110,7 @@ function clear_history() {
|
|||||||
if [[ "${BACKUP_KEEP_DAYS}" -gt 0 ]]; then
|
if [[ "${BACKUP_KEEP_DAYS}" -gt 0 ]]; then
|
||||||
color blue "delete ${BACKUP_KEEP_DAYS} days ago backup files"
|
color blue "delete ${BACKUP_KEEP_DAYS} days ago backup files"
|
||||||
|
|
||||||
local RCLONE_DELETE_LIST=($(rclone lsf "${RCLONE_REMOTE}" --min-age ${BACKUP_KEEP_DAYS}d))
|
mapfile -t RCLONE_DELETE_LIST < <(rclone lsf "${RCLONE_REMOTE}" --min-age "${BACKUP_KEEP_DAYS}d")
|
||||||
|
|
||||||
for RCLONE_DELETE_FILE in "${RCLONE_DELETE_LIST[@]}"
|
for RCLONE_DELETE_FILE in "${RCLONE_DELETE_LIST[@]}"
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ function configure_timezone() {
|
|||||||
function configure_cron() {
|
function configure_cron() {
|
||||||
local FIND_CRON_COUNT=$(crontab -l | grep -c 'backup.sh')
|
local FIND_CRON_COUNT=$(crontab -l | grep -c 'backup.sh')
|
||||||
if [[ ${FIND_CRON_COUNT} -eq 0 ]]; then
|
if [[ ${FIND_CRON_COUNT} -eq 0 ]]; then
|
||||||
echo "${CRON} sh /app/backup.sh > /dev/stdout" >> /etc/crontabs/root
|
echo "${CRON} bash /app/backup.sh > /dev/stdout" >> /etc/crontabs/root
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user