Prefix messages with DEBUG or ERROR
This commit is contained in:
parent
86ef4f31d3
commit
dea26fe311
|
@ -39,10 +39,10 @@ tar_file_name="${date_year}.${current_dir}${xz_compression_lvl}.tar.xz"
|
||||||
|
|
||||||
# If archive already exists
|
# If archive already exists
|
||||||
if [ -s "${tar_file_name}" ]; then
|
if [ -s "${tar_file_name}" ]; then
|
||||||
printf "${c_redb}%-6b${c_reset}\n" "${tar_file_name} already exists. Please manage this directory manually or remove the archive and restart."
|
printf "${c_redb}%-6b${c_reset}\n" "ERROR : ${tar_file_name} already exists. Please manage this directory manually or remove the archive and restart."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "Create an archive for ${current_dir} files between ${date_start} and ${date_end} using XZ's compression level : ${xz_compression_lvl}."
|
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG : Create an archive for ${current_dir} files between ${date_start} and ${date_end} using XZ's compression level : ${xz_compression_lvl}."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Get the list of files between the 2 dates and ignore tar files
|
## Get the list of files between the 2 dates and ignore tar files
|
||||||
|
@ -50,7 +50,7 @@ find . -type f -newermt "${date_start}" -not -newermt "${date_end}" -not -iname
|
||||||
|
|
||||||
## Check previous return code and if the archive exists with size > 0
|
## Check previous return code and if the archive exists with size > 0
|
||||||
if [ "${?}" -eq "0" ] && [ -s "${tar_file_name}" ]; then
|
if [ "${?}" -eq "0" ] && [ -s "${tar_file_name}" ]; then
|
||||||
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "${tar_file_name} successfully created, the files can be deleted."
|
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG : ${tar_file_name} successfully created, the files can be deleted."
|
||||||
find . -type f -newermt "${date_start}" -not -newermt "${date_end}" -not -iname "*.tar*" -delete
|
find . -type f -newermt "${date_start}" -not -newermt "${date_end}" -not -iname "*.tar*" -delete
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue