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
Shutdown procedures
#1
Hello,
i am very interested in finding a sensible shutdown solution for the openplotter device. 
Since I access it via vnc there would be different options. 
I think it would be nice to have a toolbox-item with a shutdown function instaead of goin the leave fullscreen - select menu - select shutdown - select shutdown - confirm - route.
At the moment I am running the shutdown command straight from a ssh session with a macro.
Maybe something like a shortcut has been done already? 

Thanks!
Reply
#2
It'd be pretty simple to create a BASH script that just contains:

#!/bin/bash
sudo /sbin/shutdown -h now

Save the script somewhere good, like /usr/local/bin/

Then create a desktop shortcut to that script. Here's a good tutorial:
https://techatplay.wordpress.com/2015/09...pberry-pi/

You can also use a little script that detects a switch closure on a GPIO pin and does a clean shutdown after a few seconds. Then you can do it with a pushbutton. Many have done it - should be easy to find with Google.
Reply
#3
Okay, now you got me interested! Here's how you would create a shortcut on the desktop to shut down:

Open a terminal.

1. Create a bash script:

Code:
cd /usr/local/bin/
nano quickshutdown.sh

insert this:

Code:
#!/bin/bash
sudo /sbin/shutdown -h now
and save with ctrl-x, y.

2. Make it executable:
Code:
sudo chmod +x quickshutdown.sh


3. Now go to your desktop and create a desktop file:
Code:
cd ~/Desktop/
nano quickshutdown.desktop
Here is what worked for me. You can adjust things like the icon and that sort of thing later if you wish.
Insert:
Code:
[Desktop Entry]
Name=Quick Shutdown
Comment=Some comment
Icon=/usr/share/pixmaps/squeak.png
Exec=/usr/local/bin/quickshutdown.sh
Type=Application
Encoding=UTF-8
Terminal=true
Save with ctrl-x y

Lastly, open your file manager. Go to Edit - Preferences - General. Check "Don't ask options on launch of executable file".

That should do it for you.
Reply
#4
Maybe it is better to quit OpenCPN first, often it needs some time to close.
I had it restet to the default settings some time, and this is really annoiing!

After the wait (10sek?) it is safe to do the "shutdown -h now".

By the way: what is the procedure to do an backup copy of the OpenCPN?
Duplicate the hidden .opencpn Folder?

many greetings
Holger

Even Better, we should write an Backup-script with the Date attached of all config Files before every Restart or Shutdown. Of course also an Restore Utility. This would help better, even if not all config files are attached.
Reply
#5
Another approach would be to include the shutdown command in the code that starts opencpn automatically if you selected that. Then it would be simply a matter of hitting Ctr+Q in opencpn and down it goes.

Even better, that could also become a selectable option next to "start opencpn automatically on startup": "shutdown after opencpn exits".
Reply
#6
Also easily done as an openplotter action. This thread uses a GPIO pin to trigger the shutdown action but you could also use any sensor, or a keypress.

http://forum.openmarine.net/showthread.php?tid=344
Reply
#7
I use a node red dashboard. Closes opencpn then shuts down the Pi. Works well, from mobile or tablet, whatever is to hand. Press a button on screen and that's it, though you still need to kill the power afterwards. Unfortunately can't get the flow right now, away from the boat.
Reply
#8
(2020-03-22, 11:14 AM)holgerw Wrote: Maybe it is better to quit OpenCPN first, often it needs some time to close.
I had it restet to the default settings some time, and this is really annoiing!

After the wait (10sek?) it is safe to do the "shutdown -h now".

The shutdown command is designed to perform a clean system shutdown, halting or powering down the system only after all running applications have been cleanly stopped. It shouldn't be necessary to close OpenCPN separately, but if you are concerned about that, you could add "killall opencpn" to the script, which would send SIGTERM to the application and close it down gracefully prior to sending "shutdown -h now".
Reply
#9
Hello and thanks for all the answers.
Maybe I was not clear with my question.
I am not looking for a hardware button or a desktop item etc.
What I would like to add is an item within the OpenCPN GUI preferrably in the toolbar that would handle the system shutdown.
Can such an item be added?

(2020-03-23, 01:41 PM)PaddyB Wrote: I use a node red dashboard. Closes opencpn then shuts down the Pi. Works well, from mobile or tablet, whatever is to hand. Press a button on screen and that's it, though you still need to kill the power afterwards. Unfortunately can't get the flow right now, away from the boat.

That seems to be close to what I am looking for. 
Have to check what node red dashboard is though Smile
Reply
#10
(2020-03-25, 04:07 PM)SailorMacSailface Wrote: Hello and thanks for all the answers.
Maybe I was not clear with my question.
I am not looking for a hardware button or a desktop item etc.
What I would like to add is an item within the OpenCPN GUI preferrably in the toolbar that would handle the system shutdown.
Can such an item be added?

(2020-03-23, 01:41 PM)PaddyB Wrote: I use a node red dashboard. Closes opencpn then shuts down the Pi. Works well, from mobile or tablet, whatever is to hand. Press a button on screen and that's it, though you still need to kill the power afterwards. Unfortunately can't get the flow right now, away from the boat.

That seems to be close to what I am looking for. 
Have to check what node red dashboard is though Smile

I use Launcher OpenCPN plugin for that.


Code:
[PlugIns/LAUNCHER]
Labels=Shutdown;Reboot
Commands=sudo shutdown -P  now;sudo reboot
HideOnBtn=1
Width=200
Height=150
PosX=256
PosY=100


Thanks,
--MG
Download BBN Marine OS for raspberry pi 

https://bareboat-necessities.github.io/m...at-os.html

Video of actual installation:

https://www.youtube.com/watch?v=3zMjUs2X3qU


Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)