@@ -13,13 +13,13 @@ fn_firstcommand_set
1313# Trap to remove lockfile on quit.
1414fn_backup_trap () {
1515 echo -e " "
16- echo -en " backup ${backupname} .tar.gz ..."
16+ echo -en " backup ${backupname} .${compressext} ..."
1717 fn_print_canceled_eol_nl
18- fn_script_log_info " Backup ${backupname} .tar.gz : CANCELED"
19- rm -f " ${backupdir:? } /${backupname} .tar.gz " | tee -a " ${lgsmlog} "
20- echo -en " backup ${backupname} .tar.gz ..."
18+ fn_script_log_info " Backup ${backupname} .${compressext} : CANCELED"
19+ rm -f " ${backupdir:? } /${backupname} .${compressext} " | tee -a " ${lgsmlog} "
20+ echo -en " backup ${backupname} .${compressext} ..."
2121 fn_print_removed_eol_nl
22- fn_script_log_info " Backup ${backupname} .tar.gz : REMOVED"
22+ fn_script_log_info " Backup ${backupname} .${compressext} : REMOVED"
2323 # Remove backup lockfile.
2424 rm -f " ${lockdir:? } /backup.lock"
2525 fn_backup_start_server
@@ -132,7 +132,6 @@ fn_select_compression() {
132132
133133# Compressing files.
134134fn_backup_compression () {
135- fn_select_compression
136135
137136 fn_print_info " A total of ${rootdirduexbackup} will be compressed."
138137 fn_script_log_info " A total of ${rootdirduexbackup} will be compressed: ${backupdir} /${backupname} .${compressext} "
@@ -161,7 +160,7 @@ fn_backup_compression() {
161160 fn_script_log_fail " Starting backup"
162161 else
163162 fn_print_ok_eol
164- fn_print_ok_nl " Completed: ${italic}${backupname} .${compressext}${default} , total size $( du -sh " ${backupdir} /${backupname} .${compressext} " | awk ' {print $1}' ) "
163+ fn_print_ok " Completed: ${italic}${backupname} .${compressext}${default} , total size $( du -sh " ${backupdir} /${backupname} .${compressext} " | awk ' {print $1}' ) "
165164 fn_script_log_pass " Backup created: ${backupname} .${compressext} , total size $( du -sh " ${backupdir} /${backupname} .${compressext} " | awk ' {print $1}' ) "
166165 alert=" backup"
167166 alert.sh
@@ -177,7 +176,7 @@ fn_backup_prune() {
177176 # How many backups exceed maxbackups.
178177 backupquotadiff=$(( backupcount - maxbackups))
179178 # How many backups exceed maxbackupdays.
180- backupsoudatedcount=$( find " ${backupdir} " / -type f -name " *.tar.gz " -mtime +" ${maxbackupdays} " | wc -l)
179+ backupsoudatedcount=$( find " ${backupdir} " / -type f -name " *.tar.* " -mtime +" ${maxbackupdays} " | wc -l)
181180 # If anything can be cleared.
182181 if [ " ${backupquotadiff} " -gt " 0" ] || [ " ${backupsoudatedcount} " -gt " 0" ]; then
183182 fn_print_dots " Pruning"
@@ -192,7 +191,7 @@ fn_backup_prune() {
192191 fn_print_dots " Pruning: Clearing ${backupquotadiff} backup(s)"
193192 fn_script_log_info " Pruning: Clearing ${backupquotadiff} backup(s)"
194193 # Clear backups over quota.
195- find " ${backupdir} " / -type f -name " *.tar.gz " -printf ' %T@ %p\n' | sort -rn | tail -${backupquotadiff} | cut -f2- -d" " | xargs rm
194+ find " ${backupdir} " / -type f -name " *.tar.* " -printf ' %T@ %p\n' | sort -rn | tail -${backupquotadiff} | cut -f2- -d" " | xargs rm
196195 fn_print_ok_nl " Pruning: Clearing ${backupquotadiff} backup(s)"
197196 fn_script_log_pass " Pruning: Cleared ${backupquotadiff} backup(s)"
198197 # If maxbackupdays is used over maxbackups.
@@ -215,15 +214,15 @@ fn_backup_prune() {
215214fn_backup_relpath () {
216215 # Written by CedarLUG as a "realpath --relative-to" alternative in bash.
217216 # Populate an array of tokens initialized from the rootdir components.
218- declare -a rdirtoks=( $( readlink -f " ${rootdir} " | sed " s/\// /g" ) )
217+ mapfile -t rdirtoks < <( readlink -f " ${rootdir} " | sed " s/\//\n /g" )
219218 if [ ${# rdirtoks[@]} -eq 0 ]; then
220219 fn_print_fail_nl " Problem assessing rootdir during relative path assessment"
221220 fn_script_log_fail " Problem assessing rootdir during relative path assessment: ${rootdir} "
222221 core_exit.sh
223222 fi
224223
225224 # Populate an array of tokens initialized from the backupdir components.
226- declare -a bdirtoks=( $( readlink -f " ${backupdir} " | sed " s/\// /g" ) )
225+ mapfile -t bdirtoks < <( readlink -f " ${backupdir} " | sed " s/\//\n /g" )
227226 if [ ${# bdirtoks[@]} -eq 0 ]; then
228227 fn_print_fail_nl " Problem assessing backupdir during relative path assessment"
229228 fn_script_log_fail " Problem assessing backupdir during relative path assessment: ${rootdir} "
@@ -268,7 +267,7 @@ fn_backup_start_server() {
268267fn_print_dots " "
269268check.sh
270269core_logs.sh
271-
270+ fn_select_compression
272271fn_backup_check_lockfile
273272fn_backup_init
274273fn_backup_stop_server
0 commit comments