acpid and poweroff - Setup

This is a discussion on acpid and poweroff - Setup ; I'm currently using a little script from the acpid package to shut down this box when the power button is pressed. Is it possible to make acpid wait until the power button is held for say 5 seconds before closing ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: acpid and poweroff

  1. acpid and poweroff

    I'm currently using a little script from the acpid package to shut down
    this box when the power button is pressed. Is it possible to make acpid
    wait until the power button is held for say 5 seconds before closing down?

    Martin.

    --
    Email: Martin Fenelon

  2. Re: acpid and poweroff

    Martin Fenelon writes:

    >I'm currently using a little script from the acpid package to shut down
    >this box when the power button is pressed. Is it possible to make acpid
    >wait until the power button is held for say 5 seconds before closing down?

    An easier way is to have it so that if you push the button twice withing 5
    sec of each other it will shut down. That makes it hard to do it
    accidentally, but allows you to shut down with the power button.

    This is what I have on my laptop


    In /etc/acpi/events/power
    event=button/power (PWR.|PBTN)
    action=/usr/local/bin/poweroff

    in /usr/local/bin/poweroff
    #!/bin/bash
    if [ -f /tmp/poweroff ] ; then
    touch -B 5 /tmp/p$$
    if newer /tmp/poweroff /tmp/p$$; then
    /sbin/poweroff
    fi
    rm /tmp/p$$
    fi
    touch /tmp/poweroff




+ Reply to Thread