aboutsummaryrefslogtreecommitdiff
path: root/etc/periodic/weekly/120.clean-kvmdb
diff options
context:
space:
mode:
Diffstat (limited to 'etc/periodic/weekly/120.clean-kvmdb')
-rwxr-xr-xetc/periodic/weekly/120.clean-kvmdb22
1 files changed, 19 insertions, 3 deletions
diff --git a/etc/periodic/weekly/120.clean-kvmdb b/etc/periodic/weekly/120.clean-kvmdb
index dbc8f4e444bb..603e70b0d017 100755
--- a/etc/periodic/weekly/120.clean-kvmdb
+++ b/etc/periodic/weekly/120.clean-kvmdb
@@ -12,8 +12,17 @@ fi
case "$weekly_clean_kvmdb_enable" in
[Yy][Ee][Ss])
- if [ -d /var/db -a -n "$weekly_clean_kvmdb_days" ]
+ if [ ! -d /var/db ]
then
+ echo '$weekly_clean_kvmdb_enable is set but /var/db' \
+ "doesn't exist"
+ rc=2
+ elif [ -z "$weekly_clean_kvmdb_days" ]
+ then
+ echo '$weekly_clean_kvmdb_enable is set but' \
+ '$weekly_clean_kvmdb_days is not'
+ rc=2
+ else
echo ""
echo "Cleaning up kernel database files:"
@@ -27,7 +36,14 @@ case "$weekly_clean_kvmdb_enable" in
print=;;
esac
- find /var/db -name "kvm_*.db" ! -name $kernel \
- -atime +$weekly_clean_kvmdb_days -delete $print
+ rc=$(find /var/db -name "kvm_*.db" ! -name $kernel \
+ -atime +$weekly_clean_kvmdb_days -delete $print |
+ tee /dev/stderr | wc -l)
+ [ -z "$print" ] && rc=0
+ [ $rc -gt 1 ] && rc=1
fi;;
+
+ *) rc=0;;
esac
+
+exit $rc