Browse Source

do not try to resize if it doesn't fit

update-rsyslog-config
lazedo 7 years ago
parent
commit
889fa8f9e1
1 changed files with 13 additions and 12 deletions
  1. +13
    -12
      system/sbin/kazoo-kamailio

+ 13
- 12
system/sbin/kazoo-kamailio View File

@ -73,23 +73,24 @@ prepare() {
rm -rf ${DB_LOCATION}/../db-backup-temp
elif [ $mountcurrentsize -gt $mountwantedsize ]; then
# check if it fits
echo "wanted size of $mountwantedsize is below current size of $mountcurrentsize , remounting"
echo "wanted size of $mountwantedsize is below current size of $mountcurrentsize , checking sizes"
mountusedsize=$(mount_point_used_size)
requiredsize=$(( mountusedsize * (100 + ${RAM_DISK_FREE_SIZE_PERC}) / 100))
if [ $requiredsize -gt $mountwantedsize ]; then
echo "wanted size of $mountwantedsize doesn't have enough space for required size of $requiredsize , setting to $requiredsize"
echo "wanted size of $mountwantedsize doesn't have enough space for required size of $requiredsize"
mountwantedsize=$requiredsize
else
echo "resizing from $mountcurrentsize to $mountwantedsize"
rm -rf ${DB_LOCATION}/../db-backup-temp
mkdir -p ${DB_LOCATION}/../db-backup-temp
cp -f ${DB_LOCATION}/* ${DB_LOCATION}/../db-backup-temp/
umount ${DB_LOCATION}
rm -rf ${DB_LOCATION}
mkdir -p ${DB_LOCATION}
mount -t tmpfs -o size=$mountwantedsize tmpfs ${DB_LOCATION}
cp -f ${DB_LOCATION}/../db-backup-temp/* ${DB_LOCATION}/
rm -rf ${DB_LOCATION}/../db-backup-temp
fi
echo "resizing from $mountcurrentsize to $mountwantedsize"
rm -rf ${DB_LOCATION}/../db-backup-temp
mkdir -p ${DB_LOCATION}/../db-backup-temp
cp -f ${DB_LOCATION}/* ${DB_LOCATION}/../db-backup-temp/
umount ${DB_LOCATION}
rm -rf ${DB_LOCATION}
mkdir -p ${DB_LOCATION}
mount -t tmpfs -o size=$mountwantedsize tmpfs ${DB_LOCATION}
cp -f ${DB_LOCATION}/../db-backup-temp/* ${DB_LOCATION}/
rm -rf ${DB_LOCATION}/../db-backup-temp
fi
fi
else


Loading…
Cancel
Save