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 and Power Off Delay
#1
I added a script to the Shut off text in /boot/firmware/config.txt per the process below.  This allows a delay to quietly close OpenCPN and Chromium.  Could this be automated and added to the options in "Raspberry Settings"

Use the Settings app, Raspberry Settings.  Set as below:
 
   
 
After this do the following:
 
  1. Create a new script file:
Code:
sudo nano /usr/local/bin/custom_shutdown.sh
 
  1. 2.  Add the following content to the script:
 
Code:
#!/bin/bash

# Kill Chromium
pkill chromium

# Kill OpenCPN
pkill opencpn

# Wait for applications to close
sleep 5

# Shutdown the system
shutdown -h now

  1. 3. Make the script executable:
 
Code:
sudo chmod +x /usr/local/bin/custom_shutdown.sh

 
  1. 4. Modify the GPIO shutdown configuration to use your custom script. Edit the /boot/firmware/config.txt file:
 
Code:
sudo nano /boot/firmware/config.txt


  1. 5. Find the line that enables GPIO shutdown and modify it to use your custom script:
 
Code:
dtoverlay=gpio-shutdown,gpio_pin=21,active_low=1,gpio_pull=down,gpio_shutdown_command=/usr/local/bin/custom_shutdown.sh
Reply


Messages In This Thread
Shutdown and Power Off Delay - by Techstyle - 2025-03-16, 09:27 PM
RE: Shutdown and Power Off Delay - by Sailoog - 2025-03-21, 01:11 PM
RE: Shutdown and Power Off Delay - by Techstyle - 2025-03-21, 03:12 PM
RE: Shutdown and Power Off Delay - by Sailoog - 2025-03-21, 07:38 PM
RE: Shutdown and Power Off Delay - by Techstyle - 2025-03-21, 08:05 PM
RE: Shutdown and Power Off Delay - by DanLXIX - 2025-09-08, 08:57 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)