rm/inc : log progress

This commit is contained in:
Jérémy Lecour 2020-04-20 00:38:44 +02:00 committed by Jérémy Lecour
parent 18e5173600
commit 35d257d9c7
3 changed files with 21 additions and 2 deletions

View file

@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
* bkctld-inc and bkctld-rm log their progress (log level "info")
### Changed
### Deprecated

View file

@ -40,7 +40,12 @@ create_inc_ext4() {
inc_name=$(date +"%Y-%m-%d-%H")
for jail_name in $(jails_list); do
jails_list=$(jails_list)
jails_total=$(echo $jails_list | wc -w)
jails_count=0
for jail_name in ${jails_list}; do
jails_count=$((jails_count+1))
jail_path=$(jail_path "${jail_name}")
inc_path=$(inc_path "${jail_name}" "${inc_name}")
incs_policy_file=$(current_jail_incs_policy_file ${jail_name})
@ -49,6 +54,7 @@ for jail_name in $(jails_list); do
if [ -n "${incs_policy_file}" ]; then
# If no incs directory is found, we don't create incs
if [ ! -d "${inc_path}" ]; then
info "inc progress: jail ${jails_count} out of ${jails_total}"
start=$(current_time)
if is_btrfs "${jail_path}"; then

View file

@ -90,19 +90,30 @@ trap "rm -f ${lock_file}; cleanup_tmp;" 0
kill_or_clean_lockfile "${lock_file}"
new_lock_file "${lock_file}"
for jail_name in $(jails_list); do
jails_list=$(jails_list)
jails_total=$(echo $jails_list | wc -w)
jails_count=0
for jail_name in ${jails_list}; do
jails_count=$((jails_count+1))
incs_policy_file=$(current_jail_incs_policy_file ${jail_name})
# If no incs policy is found, we don't remove incs
if [ -n "${incs_policy_file}" ]; then
# shellcheck disable=SC2046
incs_to_delete=$(incs_to_delete "${jail_name}" "${incs_policy_file}")
incs_total=$(echo ${incs_to_delete} | wc -w)
incs_count=0
if [ -n "${incs_to_delete}" ]; then
debug "${jail_name}: incs to be deleted : $(echo "${incs_to_delete}" | tr '\n', ',' | sed 's/,$//')."
for inc_name in ${incs_to_delete}; do
incs_count=$((incs_count+1))
info "rm progress: jail ${jails_count} out of ${jails_total} - inc ${incs_count} out of ${incs_total}"
start=$(current_time)
inc_path=$(inc_path "${jail_name}" "${inc_name}")
if is_btrfs "${inc_path}"; then
delete_inc_btrfs "${jail_name}" "${inc_name}"
else