Results 1 to 7 of 7

Thread: execute program on wake/ kill program on suspend

  1. #1

    Default execute program on wake/ kill program on suspend

    Hello,
    I have problems to get it work. i have tried to use pm-utils, but it does nothing.

    What is need is to kill application, when pc is going into suspend to ram and run that application again on wake. It's a graphical application.

    What i should do ? Thank you very much !

  2. #2
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: execute program on wake/ kill program on suspend

    On 2011-04-15 17:06, wh1sp3r wrote:
    >
    > Hello,
    > I have problems to get it work. i have tried to use pm-utils, but it
    > does nothing.
    >
    > What is need is to kill application, when pc is going into suspend to
    > ram and run that application again on wake. It's a graphical
    > application.


    You have to put script in /etc/pm/sleep.d/:

    Code:
    ---------------------
    #!/bin/bash

    .. /usr/lib/pm-utils/functions

    case "$1" in
    hibernate)
    /bin/logger -t pm-utils -p syslog.warn "--- Hibernating..."
    ;;
    suspend)
    /bin/logger -t pm-utils -p syslog.warn "--- Suspending..."
    ;;
    thaw)
    /bin/logger -t pm-utils -p syslog.warn "--- Thawing..."
    ;;
    resume)
    /bin/logger -t pm-utils -p syslog.warn "--- Resuming..."
    ;;
    *)
    ;;
    esac

    exit $?
    ---------------------


    Insert your coding in there - how you stop a graphical application is your
    problem - and start it again is a double problem.


    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.2 x86_64 "Emerald" at Telcontar)

  3. #3

    Default Re: execute program on wake/ kill program on suspend

    tried to do the above to cure internal mic fail on resume. killing alsasound before sleep and restarting on resume works.
    Here's my code of /etc/pm/sleep.d/sound

    #!/bin/bash

    case "$1" in
    suspend)
    /etc/init.d/alsasound stop
    ;;
    resume)
    /etc/init.d/alsasound start
    ;;
    *)
    ;;
    esac

    exit $?

    What am I doing wrong? Wiki for 12.1pm-utils is not available so I'm not sure of new syntax.

  4. #4
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: execute program on wake/ kill program on suspend

    On 2012-01-02 20:27, kristyon wrote:
    >
    > tried to do the above to cure internal mic fail on resume. killing
    > alsasound before sleep and restarting on resume works.
    > Here's my code of /etc/pm/sleep.d/sound
    >
    > #!/bin/bash
    >
    > case "$1" in
    > suspend)
    > /etc/init.d/alsasound stop
    > ;;
    > resume)
    > /etc/init.d/alsasound start
    > ;;
    > *)
    > ;;
    > esac
    >
    > exit $?
    >
    > What am I doing wrong? Wiki for 12.1pm-utils is not available so I'm
    > not sure of new syntax.



    This is not clear. You first say it works, later you say "What am I doing
    wrong?" Please explain.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.4 x86_64 "Celadon" at Telcontar)

  5. #5
    Join Date
    Dec 2014
    Location
    Paris
    Posts
    54

    Default Re: execute program on wake/ kill program on suspend

    Is there a way to execute a program on resuming the computer without superuser rights? (as changing /etc/... requires these superuser rights.)

    The scripts to be executed only need user rights.

  6. #6
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: execute program on wake/ kill program on suspend

    On 2015-01-12 09:36, Konfekt wrote:

    Eum... Why do you hang your question at the end of a three years old
    question, even if somewhat related? :-?



    > Is there a way to execute a program on resuming the computer without
    > superuser rights? (as changing /etc/... requires these superuser
    > rights.)
    >
    > The scripts to be executed only need user rights.


    It will depend on whether your desktop of choice implements suitable
    hooks. I'm not aware of their existence.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 13.1 x86_64 "Bottle" at Telcontar)

  7. #7
    Join Date
    Dec 2014
    Location
    Paris
    Posts
    54

    Default Re: execute program on wake/ kill program on suspend

    Quote Originally Posted by robin_listas View Post
    On 2015-01-12 09:36, Konfekt wrote:

    Eum... Why do you hang your question at the end of a three years old
    question, even if somewhat related? :-?



    > Is there a way to execute a program on resuming the computer without
    > superuser rights? (as changing /etc/... requires these superuser
    > rights.)
    >
    > The scripts to be executed only need user rights.


    It will depend on whether your desktop of choice implements suitable
    hooks. I'm not aware of their existence.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 13.1 x86_64 "Bottle" at Telcontar)

    I am using OpenSuse 13.2 with KDE desktop.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •