Send mail with rm recap

This commit is contained in:
Victor LABORIE 2017-01-10 16:19:45 +01:00
parent ebec139084
commit 30b69affa8

32
bkctld
View file

@ -446,6 +446,7 @@ sub_rm() {
fi
fi
echo $$ > $pidfile
rms_logs=""
for jail in $( ls -1 $JAILDIR ); do
incs=$(ls -1 ${INCDIR}/$jail)
if [ -f ${CONFDIR}/$jail ]; then
@ -459,21 +460,28 @@ sub_rm() {
fi
#for j in $( ls ${INCDIR}/$jail ); do
for j in $( grep -v -f <(echo "${keep}") <(echo "${incs}") ); do
echo -n "Delete $jail/$j begins at : "
/bin/date +"%d-%m-%Y ; %H:%M"
if ( check_btrfs ); then
btrfs subvolume delete ${INCDIR}/$jail/$j && touch /tmp/evobackup-rm.txt
else
cd ${INCDIR}/$jail
rsync -a --delete $empty $j*
rmdir $j* && touch /tmp/evobackup-rm.txt
fi
echo -n "Delete ${jail}/$j ends at : "
/bin/date +"%d-%m-%Y ; %H:%M"
rm_log=$(
echo -n "Delete $jail/$j begins at : "
/bin/date +"%d-%m-%Y ; %H:%M"
if ( check_btrfs ); then
btrfs subvolume delete ${INCDIR}/$jail/$j
else
cd ${INCDIR}/$jail
rsync -a --delete $empty $j*
rmdir $j*
fi
echo -n "Delete ${jail}/$j ends at : "
/bin/date +"%d-%m-%Y ; %H:%M"
)
echo "${rm_log}"
rms_logs=$(echo "${rms_logs}"; echo "${rm_log}")
done
done #| ( [ -e "/tmp/evobackup-rm.txt" ] && mail -s "[info] EvoBackup - purge incs" $MAIL && rm /tmp/evobackup-rm.txt )
done
rmdir $empty
rm $pidfile
if [ -n "${rms_logs}" ]; then
echo "${rms_logs}" | mail -s "[info] EvoBackup - purge incs" $MAIL
fi
}
## log function