Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Scheduled wake from sleep?

Featured Replies

Hi, like many, I would like my unRAID box to sleep when it is idle and either wake-on-lan or wake on schedule.  I've installed the Dynamix S3 sleep plugin and it sort of works (that is, it works while I'm at my desk sending the unRAID box to sleep then reviving it by sending the WoL packet, but if I leave the unRAID box sleeping for a day and try again the results are very iffy).  I have found absolutely no way of getting this box to wake on schedule other than by having another (Windows) PC wake up to send the WoL packet to the unRAID box!  I'm sure there has to be something more elegant than this, can anyone tell me what I'm missing?  For reference, I'm running a pretty vanilla set-up with the latest version of unRAID, on a motherboard that supports S3.

A scheduled wake up is configured in the BIOS.

Check your mainboard's manual if this functionality is available.

 

Look for something like "RTC" settings or "wake on RTC" or "resume by RTC"

 

Most of the time the possible settings are quite basic and you will probably loose the WoL functionality.

Perhaps you can run a WoL script on something like your router or mobile phone?

Edited by Fireball3

  • Author

Thanks for the quick reply, I'll give that a go in the next few days.  I wonder what Windows does to make this work that doesn't require BIOS changes.

17 minutes ago, ralphbecket said:

I wonder what Windows does to make this work that doesn't require BIOS changes.

I don't understand why you think it does?

If I understand correctly, you used a Windows machine to send the WoL packet to your server!?

I feel that there is some misunderstanding somewhere.

 

Probably related to this?

1 hour ago, ralphbecket said:

but if I leave the unRAID box sleeping for a day and try again the results are very iffy

You mean it won't wake when you send the WoL packet?

Edited by Fireball3

  • Author

Hi, @Fireball3.  The Windows Task Scheduler includes an option to wake the computer from sleep if necessary, which has always worked reliably for me without requiring any extra BIOS tweaks.  I'm just wondering how Windows manages this, but not Linux.

 

Re: the iffy WoL results after the unRAID box has been sleeping for a day or so, yes: sometimes it will wake when I send the packed from another PC, sometimes it won't.  I haven't been able to discern any pattern, unfortunately.

 

Can't say about the task scheduler, maybe that is a different sleep state?

If your router is rebooted, he will loose the reference where the server was plugged to. The packet won't reach its destination and the wake will not take place.
Maybe this happened?

2 hours ago, Fireball3 said:

If your router is rebooted, he will loose the reference where the server was plugged to. The packet won't reach its destination and the wake will not take place.
Maybe this happened?

Same thing can happen if you are using a dynamic IP address and it expires while the server is asleep.

Edited by primeval_god

  • Author

Hmm, I'll try it: we've just installed a new router, it's possible the previous one was having trouble.

 

On the other hand, I notice that unRAID comes with 'rtcwake' installed, but when I try it I get a write error:

root@Tower:~# rtcwake -s 30 -v
rtcwake: assuming RTC uses UTC ...
Using UTC time.
        delta   = -4
        tzone   = 0
        tzname  = UTC
        systime = 1497921001, (UTC) Tue Jun 20 01:10:01 2017
        rtctime = 1497921005, (UTC) Tue Jun 20 01:10:05 2017
alarm 0, sys_time 1497921001, rtc_time 1497921005, seconds 30
rtcwake: wakeup from "suspend" using /dev/rtc0 at Tue Jun 20 01:10:36 2017
suspend mode: suspend; suspending system
rtcwake: write error

 

Getting an unRAID server to wakeup on schedule can be hit or miss depending on the RTC hardware in your system. Personally I use a before sleep command that sets the RTC wake alarm directly. For me the command is echo $wake_date > /sys/class/rtc/rtc0/wakealarm 

  • Author

@primeval_god Ha ha, that worked!  Thanks a million.  I just tried out the following experiment and it worked perfectly: https://ragsagar.wordpress.com/2011/08/15/how-to-automatically-wake-up-your-computer-at-a-particular-time-resume-by-rtc-alarm-in-arch-linux/

 

I spoke too soon, I think I see what has been corrupting my flash drives now.  Resuming from sleep as above, I observe that my docker tab is gone and the log file contains the following:


Jun 20 11:49:32 Tower kernel: xhci_hcd 0000:03:00.0: HC died; cleaning up
Jun 20 11:49:32 Tower kernel: dpm_run_callback(): usb_dev_resume+0x0/0x10 returns -22
Jun 20 11:49:32 Tower kernel: PM: Device 6-2 failed to resume async: error -22
Jun 20 11:49:32 Tower kernel: PM: resume of devices complete after 11021.862 msecs
Jun 20 11:49:32 Tower kernel: Restarting tasks ... 
Jun 20 11:49:32 Tower kernel: usb 6-2: USB disconnect, device number 2
Jun 20 11:49:32 Tower kernel: done.
Jun 20 11:49:32 Tower kernel: udevd[18947]: inotify_add_watch(5, /dev/sda, 10) failed: No such file or directory
Jun 20 11:49:32 Tower s3_sleep: Wake-up from sleep mode
Jun 20 11:49:32 Tower kernel: FAT-fs (sda1): Directory bread(block 8192) failed
Jun 20 11:49:32 Tower kernel: FAT-fs (sda1): Directory bread(block 8193) failed
Jun 20 11:49:32 Tower kernel: FAT-fs (sda1): Directory bread(block 8194) failed
Jun 20 11:49:32 Tower kernel: FAT-fs (sda1): Directory bread(block 8195) failed
Jun 20 11:49:32 Tower kernel: FAT-fs (sda1): Directory bread(block 8196) failed
Jun 20 11:49:32 Tower kernel: FAT-fs (sda1): Directory bread(block 8197) failed
Jun 20 11:49:32 Tower kernel: FAT-fs (sda1): Directory bread(block 8198) failed
Jun 20 11:49:32 Tower kernel: FAT-fs (sda1): Directory bread(block 8199) failed
Jun 20 11:49:32 Tower kernel: FAT-fs (sda1): Directory bread(block 8200) failed
Jun 20 11:49:32 Tower kernel: FAT-fs (sda1): Directory bread(block 8201) failed
Jun 20 11:49:32 Tower root: 
Jun 20 11:49:32 Tower root: Warning: file_put_contents(/boot/config/docker.cfg): failed to open stream: No such file or directory in /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/dockerconfig.php on line 35
Jun 20 11:49:32 Tower root: 
Jun 20 11:49:32 Tower root: Warning: file_put_contents(/boot/config/domain.cfg): failed to open stream: No such file or directory in /usr/local/emhttp/plugins/dynamix.vm.manager/scripts/libvirtconfig.php on line 39
Jun 20 11:51:50 Tower kernel: fat__get_entry: 182 callbacks suppressed
Jun 20 11:51:50 Tower kernel: FAT-fs (sda1): Directory bread(block 8192) failed
Jun 20 11:51:50 Tower kernel: FAT-fs (sda1): Directory bread(block 8193) failed
Jun 20 11:51:50 Tower kernel: FAT-fs (sda1): Directory bread(block 8194) failed
Jun 20 11:51:50 Tower kernel: FAT-fs (sda1): Directory bread(block 8195) failed
Jun 20 11:51:50 Tower kernel: FAT-fs (sda1): Directory bread(block 8196) failed
Jun 20 11:51:50 Tower kernel: FAT-fs (sda1): Directory bread(block 8197) failed
Jun 20 11:51:50 Tower kernel: FAT-fs (sda1): Directory bread(block 8198) failed
Jun 20 11:51:50 Tower kernel: FAT-fs (sda1): Directory bread(block 8199) failed
Jun 20 11:51:50 Tower kernel: FAT-fs (sda1): Directory bread(block 8200) failed
Jun 20 11:51:50 Tower root: 
Jun 20 11:51:50 Tower root: Warning: file_put_contents(/boot/config/docker.cfg): failed to open stream: No such file or directory in /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/dockerconfig.php on line 35
Jun 20 11:51:50 Tower kernel: FAT-fs (sda1): Directory bread(block 8201) failed
Jun 20 11:51:50 Tower root: 
Jun 20 11:51:50 Tower root: Warning: file_put_contents(/boot/config/domain.cfg): failed to open stream: No such file or directory in /usr/local/emhttp/plugins/dynamix.vm.manager/scripts/libvirtconfig.php on line 39

 

Edited by ralphbecket

  • Author

@primeval_god, do you happen to know if there's something else required in the 'before sleep' command to prevent that flash drive problem from occurring on wake?

I am not aware of any, and I dont remember having any flash drive issues on wake-up. I am at work right now so I wont be able to confirm my settings until i get home.

Sorry for the delay, I can confirm that I am not doing anything special in the before sleep command other than setting the rtc. I dont know if it matters but when i set the RTC i first "echo 0 > /sys/class/rtc/rtc0/wakealarm" to clear it. As I said I have never had any flash drive issues. Shot in the dark, maybe you could try plugging the flash drive into a different USB controller on your mobo.

  • Author

No problem, I'm just grateful to receive advice (for which many thanks!).  I'll try both your suggestions over the weekend and let you know how it works out.  What's interesting is that this is a replacement flash drive: I was seeing the same kinds of problems with my previous flash, but this suggests the problem lies elsewhere.

  • 1 year later...

Hey Please check my script here:

 

https://forums.unraid.net/topic/47160-how-to-automatically-wake-from-sleep/?tab=comments#comment-649452

 

Example Monday to Friday wakeup at 9.55

time=09:55
now=$(date +%s)
other=$(date -d $time +%s)
dayofweek=$(date +%u)
if [ $now -ge $other  ] && [ $dayofweek -lt 5 ]
then
echo `date '+%s' --date='tomorrow 09:55:00'` > /sys/class/rtc/rtc0/wakealarm
elif [ $dayofweek -ge 5 ]
then
    echo `date '+%s' --date='next monday 09:55:00'` > /sys/class/rtc/rtc0/wakealarm
else
    echo `date '+%s' --date='today 09:55:00'` > /sys/class/rtc/rtc0/wakealarm
fi

 

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.