This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
opencpn.conf gets randomly emptied WALKED AROUND
#7
Higher in this script I wrote : Being a complete newbie in the art of bash/Linux, I am sure these scripts can be condensed, and then improved, maybe merged in a single script which would run automaticaly at startup ?

Well, with little inspiration and a lot of transpiration, its done now and here is the new KeepOCPN_conf_Tidy script :
Code:
# This script tests the opencpn.conf file length. If NOT 0 it will consider
# the file as valid and copy it as the new backup version.
# Else It will restore it with the former backup version.

if [ -s /home/pi/.opencpn/opencpn.conf ]; then cp /home/pi/.opencpn/opencpn.conf /home/pi/Sauvegardes/opencpn.conf;
else
    # Copy corrupted file for forensic investigations
    cp /home/pi/.opencpn/opencpn.conf /home/pi/.opencpn/garbage.ocpn.txt
    # delete corrupted file
    rm -f /home/pi/.opencpn/opencpn.conf
    # restore opencpn.conf using former backup :
    cp /home/pi/Sauvegardes/opencpn.conf /home/pi/.opencpn/opencpn.conf;

fi
What is not addressed is the case where the opencpn.conf file is corrupted AND its length is not ZERO ! But I had dozens of corruptions, and length was always zero !

Still to find how make OP run this script at startup  ! Any suggestion warmly welcomed
Cordialement
Didier B
Pi4, SSD USB3, OP 3.0 Touch SK 3.2.1 OpenCPN  5.8.4 :  Thank you  Thank you  Thank you


Reply


Messages In This Thread
RE: opencpn.conf gets randomly emptied - by Didier B - 2019-05-31, 09:31 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)