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:
Use the Settings app, Raspberry Settings. Set as below:
After this do the following:
- Create a new script file:
Code:
sudo nano /usr/local/bin/custom_shutdown.sh
- 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
- 3. Make the script executable:
Code:
sudo chmod +x /usr/local/bin/custom_shutdown.sh
- 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
- 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