You are not logged in.

#1 2026-08-03 17:43:32

MarkW
Member
Registered: 2024-11-03
Posts: 536

Trying To Creat a Cron Job To Wake My Laptop Up And Then Turn It Off

Here's my crontab

  8 2 * * * rtcwake -u -s 0 -m no >/dev/null 2>&1
10 2 * * * ROOT /usr/sbin/shutdown -h now

Not sure why it didn't work.

The Dell laptop I have doesn't pass power through unless the machine is active or in a suspended state.

Offline

#2 Yesterday 20:39:47

MarkW
Member
Registered: 2024-11-03
Posts: 536

Re: Trying To Creat a Cron Job To Wake My Laptop Up And Then Turn It Off

I tried this

30 21 * * * sudo rtcwake -u -s 60 -m off >/dev/null 2>&1

It was supposed to wake my laptop up, then turn it off after 60 seconds.  It didn't.  Full confession, I copied the command assuming it'd work.  I have no idea what >/dev/null 2>&1 is or if I even need it

Edit.  There is a file in /dev/ called null, but it's blank.  Not sure what that means

Last edited by MarkW (Yesterday 20:48:43)

Offline

#3 Yesterday 22:31:26

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 2,997

Re: Trying To Creat a Cron Job To Wake My Laptop Up And Then Turn It Off

>/dev/null 2>&1 is a command used to redirect both standard output and standard error of a command to a special file called /dev/null, discarding all output and error messages. Useful for running commands quietly - like cron jobs - without displaying any output in the terminal.


You must unlearn what you have learned.
    -- yoda

Offline

#4 Yesterday 22:57:15

MarkW
Member
Registered: 2024-11-03
Posts: 536

Re: Trying To Creat a Cron Job To Wake My Laptop Up And Then Turn It Off

That makes sense.  What doesn't is why the job didn't work.  It should have worked unless there's something wrong with my syntax (and I did check the rtcwake manpage)

Offline

#5 Yesterday 23:20:09

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 2,997

Re: Trying To Creat a Cron Job To Wake My Laptop Up And Then Turn It Off

Try with "root" instead of "ROOT"

Also try it with "systemctl poweroff" to power off the computer.

Use the full path to systemctl


You must unlearn what you have learned.
    -- yoda

Offline

#6 Today 11:18:35

MarkW
Member
Registered: 2024-11-03
Posts: 536

Re: Trying To Creat a Cron Job To Wake My Laptop Up And Then Turn It Off

The problem I'm having is with the waking up part.  For some reason cron doesn't work when the machine is suspended.  And it has to be suspended since I want power to pass through but I don't want it just going normally when I'm not using it.

I can't get rtcwake to actually wake it up from suspend.  So what am I doing wrong?

Tutorials aren't helping.

Offline

Board footer

Powered by FluxBB