Because there is a situation in my project where files cannot be saved to disk after being written, these two scripts have been added in the background. Will they have any impact on system performance?
My device may frequently experience abnormal power outages instead of rebooting or shutting down. I hope that data written to a file 1 second before the abnormal power outage can also be saved to the disk, but the actual situation is that it often fails to be saved to the disk.
My device has UPS(Uninterruptible Power System). I am using C++programming.
autoSync.sh:
#!/bin/sh
while true; do
sync
sleep 1
done
autoCacheFree.sh:
#!/bin/sh
drop_caches() {
echo "Drop caches."
sync
echo 1 > /proc/sys/vm/drop_caches &
return 0
}
while true; do
sleep 600
drop_caches
done
/etc/fstab:
#device mount-point type options dump fsck order
/dev/mmcblk3p3 /dobot ext3 defaults 0 0
/dev/mmcblk3p6 /dobot/userdata ext3 defaults 0 0
proc /proc proc defaults 0 0
tmpfs /tmp tmpfs defaults 0 0
sysfs /sys sysfs defaults 0 0
tmpfs /dev tmpfs defaults 0 0
var /dev tmpfs defaults 0 0
ramfs /dev ramfs defaults 0 0
/etc/fstabin the issue.