Results 1 to 4 of 4

Thread: [pm-utils] run script on resume

  1. #1

    Default [pm-utils] run script on resume

    Hi There,

    I am new in Linux world. Hopefully this question is not very stupid. I wrote a script to make my machine suspend for 30 secs and then wakeup automatically.

    #!/bin/bash
    echo 0 > /sys/class/rtc/rtc0/wakealarm
    echo `date '+%s' -d '+ 30 seconds'` > /sys/class/rtc/rtc0/wakealarm
    pm-suspend

    Is there any way to run a script on resume? I tried to put a script in /etc/pm/sleep.d but the messages that the script should print didn't show on the screen. I figured those messages were dumped into /var/log/pm-suspend.log but I need them to be displayed right after resume.

    My final purpose is to run 1000 suspend/resume cycles. Is there any method to show some messages on the screen and delay for few seconds after resume and then automatically suspend for another 30 secs?

    I would appreciate any suggestion. Thanks!

  2. #2
    Join Date
    Jul 2008
    Location
    Wisconsin, USA
    Posts
    187

    Default Re: [pm-utils] run script on resume

    I'm not into scripting but maybe you can clarify a few points so that others can understand better too.

    What do you mean by printing the message to the screen? Do you want it to show in the command line or some other GUI notification? If you want it to show in command line just use the echo command

    Code:
    echo something
    For delay a few seconds between command you can use sleep.

    Code:
    sleep seconds
    For other pm-ultil related stuff you can look here:

    Pm-utils - openSUSE
    openSUSE 11.3 GM + M$ Win Vista HP TX1316au AMD Athlon 64 X2 Mobile TK-55, nVidia GeForce Go 6150

    openSUSE 11.3 GM + M$ Win 7 HP dm-3 AMD Neo X2 L335, ATI Mobility Radeon HD 3200

  3. #3

    Default Re: [pm-utils] run script on resume

    Hi, Thanks for responding!

    I not using pure console, not a desktop like GNOME or KDE. I need the messages printed in command line. However the messages sent by echo in scripts under /etc/pm/sleep.d don't show on the screen, they are pushed into /var/log/pm-suspend.log directly.

    I can't make my system suspend by inserting pm-suspend in script under /etc/pm/sleep.d either. Please see an example as below:

    Code:
    #!/bin/bash
    case $1 in
        resume)
            echo "go suspend in 3 seconds..."
            sleep 3
            pm-suspend
            ;;
        *)  echo "do nothing."
            ;;
    esac
    What should I do to make my machine do suspend/resume 1000 cycles?

  4. #4
    Join Date
    Jul 2008
    Location
    Wisconsin, USA
    Posts
    187

    Default Re: [pm-utils] run script on resume

    Quote Originally Posted by opensuseycfu View Post
    I can't make my system suspend by inserting pm-suspend in script under /etc/pm/sleep.d either. Please see an example as below:
    1 thing to check is whether you've made the script executable?

    The other questions I guess I'm unfortunately unable to answer. Sorry
    openSUSE 11.3 GM + M$ Win Vista HP TX1316au AMD Athlon 64 X2 Mobile TK-55, nVidia GeForce Go 6150

    openSUSE 11.3 GM + M$ Win 7 HP dm-3 AMD Neo X2 L335, ATI Mobility Radeon HD 3200

Tags for this Thread

Posting Permissions

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