What's new

ntpMerlin Unable to reset database on large USB device

Wyehoota

New Around Here
When attempting to reset the database on a "large" USB device, the calculation for SIZEAVAIL overflows.
See code change below which is used in other scripts. Use AWK rather than SHELL to do calculation.


--- ntpmerlin
+++ ntpmerlin_NEW
@@ -1195,8 +1195,9 @@

Reset_DB(){
SIZEAVAIL="$(df -P -k "$SCRIPT_STORAGE_DIR" | awk '{print $4}' | tail -n 1)"
+ SIZEAVAIL="$(echo "$SIZEAVAIL" | awk '{printf("%s", $1*1024);}')"
SIZEDB="$(ls -l "$SCRIPT_STORAGE_DIR/ntpdstats.db" | awk '{print $5}')"
- if [ "$SIZEDB" -gt "$((SIZEAVAIL*1024))" ]; then
+ if [ "$SIZEDB" -gt "$SIZEAVAIL" ]; then

Print_Output true "Database size exceeds available space. $(ls -lh "$SCRIPT_STORAGE_DIR/ntpdstats.db" | awk '{print $5}')B is required to create backup." "$ERR"
return 1
 

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Back
Top