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-2019, 04:32   #1
Registered User

Join Date: Aug 2016
Location: Stockholm, Sweden
Posts: 285
OpenCPN graceful shutdown

Having problems getting OpenCPN to do a graceful shutdown using Ubuntu 16.04 and Xfce.
The machine is an OpenCPN-dedicated machine used only for navigation plus some support programs, the user is automatically logged in.
The machine is a 'CAR-PC'-type mini-ITX with an M2-ATX style power supply and is hence powered up/down much like using the start/retset-button on a constantly powered-on PC system.

Systemd is used and the command for shutdown is 'ExecStop=/usr/bin/pkill -15 opencpn', I have not bothered with a pid-file as 'pkill' works just fine when using the service commands.
I am also using the 'Type=oneshot' alternative and 'After=local-fs.target display-manager.service lightdm.service' trying to keep the GUI active during shutdown ('After' and 'Before' are then reversed)


While the machine is running, with the user logged in and displaying the GUI, systemd service can be used to start/stop opencpn using the normal service start and stop commands. OpenCPN is then properly shutdown and the last line in the log displays 'opencpn::MyApp exiting cleanly...', leaving the GUI up.


However, when the machine is powered down using the 'start/reset-button' (read 'power switch'), triggering a SIGTERM signal, it seems to be forced down and not given a chance to save the configuration file. The log file then ends with 'Got quitflag from SIGNAL' or sometimes a few lines after that.

On a regular PC one may use the GUI Restart functionality, or even 'sudo init 6', which apparently uses SIGTERM to shutdown the application. The effect appears to be the same as when using the power switch functionality on the 'CAR-PC'.


This 'forceful' shutdown are causing several problems, among these are:
- The configuration file sometimes gets corrupt (this could be really bad).
- A newly selected chart bundle is forgotten and falls back to the last properly saved selection.
The sometimes corrupted configuration file is the worst and has happened to me on numerous occasions.


A SIGTERM is supposed to trigger a program-friendly shutdown but that appears not to be the case here.
The problem looks similar to bug #2245. I have tried the proposed suggestion using screen, but to no avail. It is never delayed long enough for the log to display 'opencpn::MyApp exiting cleanly...', often not delayed at all.


Is there any way to force a 'graceful' shutdown?
Are there any other systemd '[Unit]'-alternatives that could prove useful?

Just a final note: I am no programmer so some of the above 'SIGTERM' notes are more or less educated guesses learned from experience.



Thanks in advance for any ideas or clues
Lennart
LennartG is offline   Reply With Quote
Old 27-02-2019, 23:29   #2
Registered User

Join Date: Aug 2016
Location: Stockholm, Sweden
Posts: 285
Re: OpenCPN graceful shutdown

Problem solved. at least for Ubuntu 16.04. See page https://opencpn.org/wiki/dokuwiki/do...linux_shutdown


This might inspire someone to test a similat procedure for Windows. I, myself, have not touched a Windows system in years.
LennartG is offline   Reply With Quote
Reply

Tags
enc, opencpn, race


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
Perkins 4-108 Power Loss and Shutdown RJ86 Engines and Propulsion Systems 25 19-10-2021 09:04
Air-X Wind Generator in Shutdown Mode seandepagnier Electrical: Batteries, Generators & Solar 6 17-03-2021 12:27
Graceful vee berth exit? Mattdwyerva Monohull Sailboats 41 04-10-2014 06:04
Unexplained Ford-Lehman Shutdown jan bogart Powered Boats 2 21-06-2010 06:13
Adler Barbour recharge after long shutdown? svnakia Plumbing Systems and Fixtures 11 23-07-2008 13:48

Advertise Here


All times are GMT -7. The time now is 07:20.


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.