Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: How to have openSUSE 13.1 KDE resume from suspend at set time?

  1. #1
    Join Date
    Aug 2008
    Location
    San Francisco
    Posts
    400

    Default How to have openSUSE 13.1 KDE resume from suspend at set time?

    System is openSUSE 13.1 KDE 32-bit with all updates. I installed Back in Time 1.0.34, and configured it to do incremental backups daily at 2:00 AM. It works correctly if the system is running at 2:00 AM, but nothing happens if the system is suspended to RAM.

    How can I get the system to resume daily at say 1:55 AM so the backup runs?

    I looked at rtcwake, but it seems like a one-shot approach, not something that will run daily.

    I'm trying to duplicate the function of Windows task scheduler, which has a selectable option to wake the system to run a task.

    How can this be done in openSUSE?

    Thanks,
    Howard

  2. #2
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,578
    Blog Entries
    1

    Default Re: How to have openSUSE 13.1 KDE resume from suspend at set time?

    I've never had need to do this, but have a look at
    Code:
    man rtcwake
    That might provide what you need.

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

    Default Re: How to have openSUSE 13.1 KDE resume from suspend at set time?

    On 2014-06-18 02:16, crmrhm wrote:

    > I looked at rtcwake, but it seems like a one-shot approach, not
    > something that will run daily.


    Did you try?

    If you confirm it does that, you can simply set it up again when your
    backup job ends.

    But it appears that you have to call it every time you suspend, instead
    of the default call.

    --
    Cheers / Saludos,

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

  4. #4
    Join Date
    Jul 2008
    Location
    Seattle, WA
    Posts
    17,078

    Default Re: How to have openSUSE 13.1 KDE resume from suspend at set time?

    On Wed, 18 Jun 2014 00:16:01 +0000, crmrhm wrote:

    > I looked at rtcwake, but it seems like a one-shot approach, not
    > something that will run daily.


    Not on its own, maybe, but a cron job to schedule it would solve that.

    Jim



    --
    Jim Henderson
    openSUSE Forums Administrator
    Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

  5. #5
    Join Date
    Aug 2008
    Location
    San Francisco
    Posts
    400

    Default Re: How to have openSUSE 13.1 KDE resume from suspend at set time?

    AFAICT, rtcwake has two ways to set a wake time:

    1) Sets the wakeup time to seconds in future from now.

    2) Sets the wakeup time to the absolute time time_t. time_t is the time in seconds since 1970-01-01, 00:00 UTC.

    This backup is desired on systems that randomly suspend and resume during the day.

    Option 1 could be run daily by a cron job to wake after some elapsed time, but the system has to be up for the cron job to run, and that is uncertain.

    Option 2 requires a new absolute time set daily.

    I find no way for rtcwake to use a relative time, such as 1:55 AM daily.

    Back in Time can use anacron to schedule execution. This will run it after anything has caused the system to resume. I'll try this approach. It would be nice to have the backup run every night when all is quiet, but I can see no way to make that happen automatically.
    Regards,
    Howard

  6. #6
    Join Date
    Jul 2008
    Location
    Seattle, WA
    Posts
    17,078

    Default Re: How to have openSUSE 13.1 KDE resume from suspend at set time?

    On Wed, 18 Jun 2014 05:06:01 +0000, crmrhm wrote:

    > 2) Sets the wakeup time to the absolute time time_t. time_t is the time
    > in seconds since 1970-01-01, 00:00 UTC.
    >
    > This backup is desired on systems that randomly suspend and resume
    > during the day.
    >
    > Option 1 could be run daily by a cron job to wake after some elapsed
    > time,
    > but the system has to be up for the cron job to run, and that is
    > uncertain.
    >
    > Option 2 requires a new absolute time set daily.


    Option 2 would be the simplest, since it wouldn't take much scripting to
    generate a date string that was for "tomorrow" and plug that in as a
    parameter to rtcwake. The date command can give you the time_t value
    based on a string value IIRC; the conversion is a pretty standard
    conversion.

    In fact, if you figure out the time on one particular date, the number of
    seconds to the next time is a fixed value (86400 IIRC), so it actually is
    just simple addition to the previous wake value if you know what that is
    (and you could store that somewhere, then read it, compute the new value,
    write it back to the temp file, and use it for the next scheduled rtcwake
    call).

    Jim



    --
    Jim Henderson
    openSUSE Forums Administrator
    Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

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

    Default Re: How to have openSUSE 13.1 KDE resume from suspend at set time?

    On 2014-06-18 07:06, crmrhm wrote:
    >
    > AFAICT, rtcwake has two ways to set a wake time:
    >
    > 1) Sets the wakeup time to seconds in future from now.
    >
    > 2) Sets the wakeup time to the absolute time time_t. time_t is the time
    > in seconds since 1970-01-01, 00:00 UTC.


    AFAICS, there is another problem.

    rtcwake sets the computer to sleep _now_, with a wake up time programmed.

    At least, that is how I understand the man page:

    rtcwake - enter a system sleep state until specified wakeup time

    rtcwake [options] [-d device] [-m standby_mode] {-t time_t|-s seconds}


    Thus, you specify a sleep mode (standby, hibernate, etc), and when to
    wake up. And it goes into that state immediately. That being so, you
    have to replace the system call to sleep with a call to rtcwake instead.

    --
    Cheers / Saludos,

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

  8. #8
    Join Date
    Aug 2008
    Location
    San Francisco
    Posts
    400

    Default Re: How to have openSUSE 13.1 KDE resume from suspend at set time?

    Quote Originally Posted by robin_listas View Post
    AFAICS, there is another problem.

    rtcwake sets the computer to sleep _now_, with a wake up time programmed.

    At least, that is how I understand the man page:

    rtcwake - enter a system sleep state until specified wakeup time

    rtcwake [options] [-d device] [-m standby_mode] {-t time_t|-s seconds}


    Thus, you specify a sleep mode (standby, hibernate, etc), and when to
    wake up. And it goes into that state immediately. That being so, you
    have to replace the system call to sleep with a call to rtcwake instead.
    One of rtcwake's standby_modes is
    Code:
    no          Don't suspend. The rtcwake command sets RTC wakeup time only.
    so the system does not go to sleep, just changes the wake time.

  9. #9
    Join Date
    Aug 2008
    Location
    San Francisco
    Posts
    400

    Default Re: How to have openSUSE 13.1 KDE resume from suspend at set time?

    Quote Originally Posted by hendersj View Post
    Option 2 would be the simplest, since it wouldn't take much scripting to
    generate a date string that was for "tomorrow" and plug that in as a
    parameter to rtcwake. The date command can give you the time_t value
    based on a string value IIRC; the conversion is a pretty standard
    conversion.

    In fact, if you figure out the time on one particular date, the number of
    seconds to the next time is a fixed value (86400 IIRC), so it actually is
    just simple addition to the previous wake value if you know what that is
    (and you could store that somewhere, then read it, compute the new value,
    write it back to the temp file, and use it for the next scheduled rtcwake
    call).

    Jim
    Looks like it is finally time for me to learn something about scripting. And 86400 is correct.
    Thanks,
    Howard

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

    Default Re: How to have openSUSE 13.1 KDE resume from suspend at set time?

    On 2014-06-18 17:06, crmrhm wrote:
    >
    > robin_listas;2649547 Wrote:



    >> Thus, you specify a sleep mode (standby, hibernate, etc), and when to
    >> wake up. And it goes into that state immediately. That being so, you
    >> have to replace the system call to sleep with a call to rtcwake instead.


    > One of rtcwake's standby_modes is
    > Code:
    > --------------------
    > no Don't suspend. The rtcwake command sets RTC wakeup time only.
    > --------------------
    > so the system does not go to sleep, just changes the wake time.


    Ah, I did not see that one.

    Then you can issue that command after running the backup job, and on
    other occasions. Let me think... Ah, place a script in /etc/pm/sleep.d/,
    to trigger on suspend/hibernate.

    /etc/pm/sleep.d/06wakeup:

    Code:
    #!/bin/bash
    
    .. /usr/lib/pm-utils/functions
    
    case "$1" in
    hibernate|suspend)
    rtcwake ... something.
    ;;
    *)
    ;;
    esac
    exit $?

    That would automatically activate it every time you suspend. :-)

    --
    Cheers / Saludos,

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

Page 1 of 2 12 LastLast

Posting Permissions

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