Power Button Additional Commands

jgregoire
jgregoire New Member Posts: 2

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

  • Pratik_Kushwaha
    Pratik_Kushwaha Guest Posts: 123 ✭✭✭

    Hi @jgregoire ,

    We are looking into this and will get back to you around next week with updates. Thanks.

    Regards,
    Pratik

  • ashwanimathur
    ashwanimathur New Member Posts: 2

    +1 .. looking for response to same issue

  • camillus
    camillus Administrator, Moderator, AAEON Posts: 188 admin

    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,

Privacy Policy