Cruisers Forum
 


Reply
  This discussion is proudly sponsored by:
Please support our sponsors and let them know you heard about their products on Cruisers Forums. Advertise Here
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 11-02-2024, 09:45   #1
Registered User

Join Date: Apr 2012
Posts: 59
How does _OpenCPN_SILock work?

Hello.
If I pull the power on the Raspberry pi, or reboot without shutting down OpenCPN then I get the safe mode dialog box. I believe this is something to do with _OpenCPN_SILock but I can't figure out how it works? I have looked at the attributes of the file etc. Can someone enlighten me? I have a python Tkinter app to manage the launching and shutting down of OpenCPN and the pi but I want to see if I can mitigate for a bad shutdown. Ideally I would find out if there was a clean shutdown or not on boot and take action if not. Mostly it revolves around having a backup opencpn.conf file at the ready.
Thanks
jimseng is offline   Reply With Quote
Old 11-02-2024, 11:57   #2
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,151
Re: How does _OpenCPN_SILock work?

To not risk damage files it's vital to close OCPN before power off, correct.
Maybe you can use something like this to close from a script:
pi@RPi4:~ $ ps -C opencpn
PID TTY TIME CMD
1500 ? 12:07:43 opencpn
pi@RPi4:~ $ kill -s SIGUSR1 1500
If no answer for opencpn it's closed and you can power off.
But Linux is not my native world so there may be better ways.
Hakan is offline   Reply With Quote
Old 11-02-2024, 12:18   #3
Registered User

Join Date: Apr 2012
Posts: 59
Re: How does _OpenCPN_SILock work?

I already do close it with python. I'm asking what if the power goes by mistake. Or more to the point. How does OpentCPN know it has been brutally shut down?
jimseng is offline   Reply With Quote
Old 11-02-2024, 12:44   #4
Registered User

Join Date: Mar 2016
Location: San Francisco
Boat: Morgan 382
Posts: 2,942
Re: How does _OpenCPN_SILock work?

Quote:
Originally Posted by jimseng View Post
I already do close it with python. I'm asking what if the power goes by mistake. Or more to the point. How does OpentCPN know it has been brutally shut down?
OpenCPN saves its state and all it's files when it shuts down. If it doesn't shut down properly, it looses changes to those files, any configuration changes you made, changes to chart display, preferences, etc. are all lost. Those changes are not saved when you make them, they are saved when OCPN shuts down.

I'm not sure exactly, but I assume it is the state of these files how OCPN knows it did not shut down.

How often does your system shutdown unexpectedly? It was maybe a once a year occurrence on my circumnavigation, with passages as long as 30 days. Running 24/7 on a windows laptop. If it happens often enough to be an issue, I would worry less about the dialog, and more about the reliability of your system.
__________________
-Warren
wholybee is offline   Reply With Quote
Old 11-02-2024, 12:58   #5
Registered User

Join Date: Apr 2012
Posts: 59
Re: How does _OpenCPN_SILock work?

I'm in the process of putting a system together. I know it's the file opencpn.conf that gets saved when OpenCPN is closed properly. I'm looking at all possibilities scenarios, one of which is that someone might shutdown/reboot/isolate the batteries/a fuse might blow etc. I'm specifically after the technical reason how OpenCPN can tell it hasn't been closed correctly.
jimseng is offline   Reply With Quote
Old 11-02-2024, 12:58   #6
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,402
Re: How does _OpenCPN_SILock work?

To answer the OP's question:


1. OCPN creates the _OpenCPN_SILock when it starts up normally.
2. As one of the very last things OCPN does on a normal clean shutdown, he deletes the _OpenCPN_SILockfile.


So, if you are planning to "pull the rug" from under OCPN, in your script you could delete the lock file. OCPN will start normally next time, with or without corrupted files.


Good Luck
Dave
bdbcat is offline   Reply With Quote
Old 11-02-2024, 13:37   #7
Registered User

Join Date: Apr 2012
Posts: 59
Re: How does _OpenCPN_SILock work?

That's what I thought Dave, hence the subject. However it seems not to be the case. _OpenCPN_SILock seems to be a red herring. I just notice that startcheck.dat is the file that gets created and deleted now and that is the file I should be checking for when my Rpi boots. you beat me to it before I could answer my own question!
jimseng is offline   Reply With Quote
Old 11-02-2024, 17:12   #8
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,402
Re: How does _OpenCPN_SILock work?

jimseng...


I stand corrected.
Thanks
Dave
bdbcat is offline   Reply With Quote
Reply

Tags
enc, opencpn, work


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rotational Work - Can we make it work Eucablue Europe & Mediterranean 2 23-04-2017 18:01
Looking to Work From Home, Online work, etc. 1Earth Boat Ownership & Making a Living 10 27-01-2016 09:54
Navtex - Where does it work? Weyalan Marine Electronics 4 28-02-2007 16:40
Sterling Silver flatware on board - how well does it work? Jon D Cooking and Provisioning: Food & Drink 20 22-07-2006 19:19

Advertise Here


All times are GMT -7. The time now is 02:19.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.