Opened 16 years ago

Last modified 16 years ago

#14 closed defect

driftfile writing is causing un-nessasiraly load on flash disk — at Initial Version

Reported by: rick Owned by: somebody
Priority: major Milestone:
Keywords: Cc:
Resource needed to fix:

Description

/usr/local/bin/write_ntpdrift is mounting before even the needs to be mounting. Should be something like this

#!/bin/sh
# Back-up ntp.drift file changes to flash. 

SRC="/var/db/ntp.drift"
DST="/cfg/local/ntp.drift"

EX_OK=1
EX_NOINPUT=66
EX_CANTCREAT=73

# Check whether source exists
if [ ! -r $SRC ]; then
    echo "ERROR: '$SRC' not readable!" 1>&2
    exit $EX_NOINPUT

# Check whether target is writable
if [ ! -w $DST ]; then
    echo "ERROR: '$DST' not writeable!" 1>&2
    exit $EX_CANTCREAT
fi

# Compare files, ignore white spaces, modification, etc
diff -b -B -q ${SRC} ${DST}
if [ $? -eq 1 ]; then
  #XXX: When is disks is already mounted for some reason (other process, script call, make sure to keep it's previous state
  mount -uwo noatime /cfg
  cp ${SRC} ${DST}
  umount /cfg
fi

exit $EX_OK

Change History (0)

Note: See TracTickets for help on using tickets.