Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 11-02-2019, 05:32   #1
Registered User

Join Date: Aug 2016
Location: Stockholm, Sweden
Posts: 13
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
Reply

Tags
enc, opencpn, race

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Graceful vee berth exit? Mattdwyerva Monohull Sailboats 41 04-10-2014 07:04
Perkins 4-108 Power Loss and Shutdown RJ86 Engines and Propulsion Systems 17 17-05-2011 16:50
Air-X Wind Generator in Shutdown Mode boat_alexandra Electrical: Batteries, Generators & Solar 5 05-08-2010 10:18
Unexplained Ford-Lehman Shutdown jan bogart Powered Boats 2 21-06-2010 07:13
Adler Barbour recharge after long shutdown? svnakia Plumbing Systems and Fixtures 11 23-07-2008 14:48



Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -7. The time now is 03:50.


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

ShowCase vBulletin Plugins by Drive Thru Online, Inc.