Opened 16 years ago
Closed 16 years ago
#14 closed defect (fixed)
driftfile writing is causing un-nessasiraly load on flash disk
Reported by: | rick | Owned by: | somebody |
---|---|---|---|
Priority: | major | Milestone: | |
Keywords: | Cc: | ||
Resource needed to fix: |
Description (last modified by ) ¶
/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 writable!" 1>&2 exit $EX_CANTCREAT fi exit $EX_OK
Change History (3)
comment:1 by , 16 years ago
comment:2 by , 16 years ago
Description: | modified (diff) |
---|
You are right, part
# 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
needs to include extra check on non existence
# Compare files, ignore white spaces, modification, etc diff -b -B -q ${SRC} ${DST}; RETVAL=$? if [ [ $RETVAL -ne 0 ]; then #2: DST does not yet, exists, 1: file differs #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
comment:3 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Rick,
Thanks for the update. I understand your point about the flash disk getting
mounted unnecessarily, but in the example above i don`t quite get the point
where you compare the source and destination file for changes. At the moment
that the file differences are being checked, the destination is not yet
available right ?