Power Button Additional Commands

I'm using an external power button on CN2 to power down the device. I need the system to run the command systemctl stop yourservice
when the power button is pressed. I've tried adding a custom ACPI script and function for this command. If I run this ACPI service I've created, it functions as expected and shuts the system down. However, pressing the power button doesn't do anything.
I'm pretty sure the /sbin/shutdown binary is taking precedence.
Can anyone provide any help as to what can be done in this situation? I would just like the power button to run a script or command on button press.
OS: Ubuntu 18.04
Kernel: 5.4.0
Comments
-
Hi @jgregoire ,
We are looking into this and will get back to you around next week with updates. Thanks.
Regards,
Pratik -
+1 .. looking for response to same issue
-
Hi @jgregoire ,
On which device are you trying this?
Kindly follow the example guide on the man page of acpid here
I have tested stopping ssh service and looking at the syslog using (/usr/bin/tail -f /var/log/syslog) during shutdown I see it does it. Following the example, I added a sleep function on the script and varied the time and I see the system waits before shutdown so it detects the script. Also after shut down I can Power On using the Power button and it Powers On.
Can you share how you are testing yours?
Best Regards,
Categories
- 301 All Categories
- 104 Announcements & News
- 51 Product News - New Product/Product Change Notice/ End-of-life
- 184 Welcome Developers!
- 52 Unboxing & Project Sharing
- 24 Tech Updates
- 546 UP Products
- 1 UP Xtreme i12
- UP Squared Pro 7000
- 1 UP Element i12 Edge
- 10 UP Squared V2
- 25 UP 4000
- 23 UP Xtreme i11
- 34 UP Squared 6000
- 44 UP Squared Pro
- 140 UP Xtreme
- 818 UP Squared
- 1.4K UP Board
- 89 UP Core Plus
- 221 UP Core
- 3 UP Xtreme Lite
- 43 UP AI Edge
- 215 Starter Kits & Peripheral