Suspend file server (ubuntu 19.04) only during weekday daytime


I am running my file server, but it is not used during the daytime of the weekday. So I’m going to suspend it when I don’t use.

Command to use

According to my sources, rtcwake command can suspend specified time and return automatically, and
crontab can run the command regularly.
So I try the two command for the purpose.


Open the configuration file with the following command.

$ crontab-e

Add commands that you want to repeat periodically to the file in the following format

Minute hour Day Month Day command

The day of the week begins on Monday and is like Sunday.

This time, I want to suspend from 7:30 a.m. on weekdays while I go to work, so I set like following.

30 7 * * 1-5 Command


Command to suspend or shut down for a specified time and then return.
-m mem option will suspend and -s option specify the number of seconds.

I’ll try suspending it for 10 seconds.

$ sudo rtcwake -m mem -s 10
rtcwake: Assume rtc uses UTC ...
rtcwake: Sat Jul 20 02:23:09 2019
 use /dev/rtc0 to return from "mem"

I was able to return safely.

In my case, i want to sleep for 10 hours = 36,000 seconds while i’m at work, so I’ll set the following.

$ rtcwake -m mem -s 36000

Actual steps

Basically rtcwake done by superuser, so if I want to run rtcwake regularly with crontab, I need to set crontab as superuser.

$ sudo crontab -e

Add the following

30 7 * * 1-5 rtcwake -m mem -s 36000


Under follow-up.

Actually, I don’t know how do I confirm that whether it suspend properly while going to work on weekdays.
So it is necessary to find the method to confirm it.


rtcwake – 指定時間になったらスリープ/休止状態/電源OFFから自動的に復帰 Linux
crontab 設定

Other translations