Merge "xenapi: Fix console rotate script"

This commit is contained in:
Jenkins 2013-07-27 14:57:33 +00:00 committed by Gerrit Code Review
commit 7f45bacc53

View File

@ -44,13 +44,16 @@ domains=$($list_domains | sed '/^id*/d' | sed 's/|.*|.*$//g' | xargs)
for i in $domains; do
log="${log_file_base}$i"
tmp="${tmp_file_base}$i"
size=$(stat -c%s "$tmp")
# Trim the log if required
if [ "$size" -gt "$max_size_bytes" ]; then
tail -c $truncated_size_bytes $tmp > $log || true
else
mv $tmp $log || true
if [ -e "$tmp" ]; then
size=$(stat -c%s "$tmp")
# Trim the log if required
if [ "$size" -gt "$max_size_bytes" ]; then
tail -c $truncated_size_bytes $tmp > $log || true
else
mv $tmp $log || true
fi
fi
# Notify xen that it needs to reload the file