Wake On Lan (WOL) -- Help!  [Solved]

Message
Author
User avatar
towwire
Posts: 681
Joined: Fri Oct 15, 2010 12:15 pm

Re: Wake On Lan (WOL) -- Help!

#41 Post by towwire »

I only use SysVinit, it still works on my computer. But let it be known that I am still on MX 21.3.
It is easier to fight for one's principles then to live up to them.

User avatar
operadude
Posts: 903
Joined: Tue Nov 05, 2019 12:08 am

Re: Wake On Lan (WOL) -- Help!

#42 Post by operadude »

towwire wrote: Sun Dec 15, 2024 7:30 pm I only use SysVinit, it still works on my computer. But let it be known that I am still on MX 21.3.
Another blast from the past :exclamation:

I will test on my (SysVinit) system, and let you know if it works...

Finished setting-up cronjob in Job Scheduler, and rebooting now...

User avatar
operadude
Posts: 903
Joined: Tue Nov 05, 2019 12:08 am

Re: Wake On Lan (WOL) -- Help!

#43 Post by operadude »

@Senpai @towwire

Failed test using:

Image

pre-test data:

Code: Select all

opera-dude@GA-H270-HD3:~
$ date
Mon Dec 16 09:55:34 AM IST 2024
opera-dude@GA-H270-HD3:~
$ sudo ethtool eth0 | grep Wake-on
	Supports Wake-on: pumbg
	Wake-on: d
post-test (reboot) data:

Code: Select all

opera-dude@GA-H270-HD3:~
$ date
Mon Dec 16 10:12:48 AM IST 2024
opera-dude@GA-H270-HD3:~
$ sudo ethtool eth0 | grep Wake-on
	Supports Wake-on: pumbg
	Wake-on: d
Will try now using "sbin", instead...

User avatar
operadude
Posts: 903
Joined: Tue Nov 05, 2019 12:08 am

Re: Wake On Lan (WOL) -- Help!

#44 Post by operadude »

Failure (using Job Scheduler):

$ sudo ethtool eth0 | grep Wake-on
[sudo] password for opera-dude:
Supports Wake-on: pumbg
Wake-on: d

However, manually, when I do this in CLI, I get:

Code: Select all

$ date
Mon Dec 16 10:30:08 AM IST 2024

$ sudo /sbin/ethtool -s eth0 wol g

$ sudo ethtool eth0 | grep Wake-on
	Supports Wake-on: pumbg
	Wake-on: g
Not sure why my setup in the Job Scheduler is not working :confused:


And, BTW, "ethtool" is no longer in "/usr/bin", but in "/sbin/", as @Senpai noted:

Code: Select all

$ /usr/bin/ethtool -s eth0 wol g
bash: /usr/bin/ethtool: No such file or directory
So, just not sure how to correctly set-up Job Scheduler. Did as suggested, but not working:

Image

I am starting Job Scheduler as root...

OK, see my error in the CLI:

I used "/usr/bin", when I should have used "/usr/sbin", as @towwire suggested.

Trying again...
Maybe that's the problem ?

User avatar
operadude
Posts: 903
Joined: Tue Nov 05, 2019 12:08 am

Re: Wake On Lan (WOL) -- Help!

#45 Post by operadude »

@Senpai and @towwire :number1:

So, this DOES work:

Image

The problem was that even using "@reboot", it wasn't actually scheduling it until Midnight!

Image

Also, here is what I get when looking for where crontab ("cron") lives:

Code: Select all

$ which cron
/sbin/cron
opera-dude@GA-H270-HD3:~
$ su
Password: 
root@GA-H270-HD3:/home/opera-dude# which cron
/sbin/cron
I did a manual check, and it also lives in:

Code: Select all

/usr/sbin/
So, looks like we have a winner, either way!

User avatar
DukeComposed
Posts: 1393
Joined: Thu Mar 16, 2023 1:57 pm

Re: Wake On Lan (WOL) -- Help!

#46 Post by DukeComposed »

operadude wrote: Mon Dec 16, 2024 4:24 am The problem was that even using "@reboot", it wasn't actually scheduling it until Midnight!
That's odd. "@reboot" in a crontab is intended to be run when the system starts. As in "After I reboot the machine, cron should run this line as soon as it comes back up again". Maybe it should have been called "@startup", but nonetheless it doesn't have a scheduled time and date when it runs. This is all just assuming standard Vixie cron, of course. I don't know what other cron replacements do.

User avatar
operadude
Posts: 903
Joined: Tue Nov 05, 2019 12:08 am

Re: Wake On Lan (WOL) -- Help!

#47 Post by operadude »

DukeComposed wrote: Mon Dec 16, 2024 4:54 am
operadude wrote: Mon Dec 16, 2024 4:24 am The problem was that even using "@reboot", it wasn't actually scheduling it until Midnight!
That's odd. "@reboot" in a crontab is intended to be run when the system starts. As in "After I reboot the machine, cron should run this line as soon as it comes back up again". Maybe it should have been called "@startup", but nonetheless it doesn't have a scheduled time and date when it runs. This is all just assuming standard Vixie cron, of course. I don't know what other cron replacements do.
Thanks for the feedback!

Yeah, something weird is going on:

I just rebooted, since I see that I deleted the default instructions for crontab, so I copied them from my KDE install and put them back on the Xfce (where I was modifying crontab via Job Scheduler).

On Xfce, where my cronjob lives:

Code: Select all

opera-dude@GA-H270-HD3:~
$ sudo crontab -l
[sudo] password for opera-dude:            

# # Edit this file to introduce tasks to be run by cron.
# # 
# # Each task to run has to be defined through a single line
# # indicating with different fields when the task will be run
# # and what command to run for the task
# # 
# # To define the time you can provide concrete values for
# # minute (m), hour (h), day of month (dom), month (mon),
# # and day of week (dow) or use '*' in these fields (for 'any').
# # 
# # Notice that tasks will be started based on the cron's system
# # daemon's notion of time and timezones.
# # 
# # Output of the crontab jobs (including errors) is sent through
# # email to the user the crontab file belongs to (unless redirected).
# # 
# # For example, you can run a backup of all your user accounts
# # at 5 a.m every week with:
# # 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
# # 
# # For more information see the manual pages of crontab(5) and cron(8)
# # 
# # m h  dom mon dow   command
 
@reboot /usr/sbin/ethtool -s eth0 wol g
And, after re-boot (a few minutes ago):

Code: Select all

$ sudo ethtool eth0 | grep Wake-on
	Supports Wake-on: pumbg
	Wake-on: d
"Wake-on: " should be followed by a "g"; NOT a "d".

So, not sure :confused:

At this point, I'll just stick with "sudo etherwake <MAC Address>", which just works OOTB :happy:

User avatar
DukeComposed
Posts: 1393
Joined: Thu Mar 16, 2023 1:57 pm

Re: Wake On Lan (WOL) -- Help!

#48 Post by DukeComposed »

operadude wrote: Mon Dec 16, 2024 5:02 am Yeah, something weird is going on:

"Wake-on: " should be followed by a "g"; NOT a "d".

So, not sure :confused:

At this point, I'll just stick with "sudo etherwake <MAC Address>", which just works OOTB :happy:
I'd check the logs to see if the command is running at startup as expected. One of the problems with trying to schedule something to always happen at startup is making sure the thing you want to do doesn't get run before the device/file/mountpoint you want to edit is up and initialized.

I'd honestly check if I couldn't put my network interface configs in /etc/network/interfaces or /etc/network/if-pre-up.d or if-up.d instead.

User avatar
operadude
Posts: 903
Joined: Tue Nov 05, 2019 12:08 am

Re: Wake On Lan (WOL) -- Help!

#49 Post by operadude »

@DukeComposed

Thanks!

Will check it out.

User avatar
towwire
Posts: 681
Joined: Fri Oct 15, 2010 12:15 pm

Re: Wake On Lan (WOL) -- Help!

#50 Post by towwire »

DukeComposed wrote: Mon Dec 16, 2024 4:54 am
operadude wrote: Mon Dec 16, 2024 4:24 am The problem was that even using "@reboot", it wasn't actually scheduling it until Midnight!
That's odd. "@reboot" in a crontab is intended to be run when the system starts. As in "After I reboot the machine, cron should run this line as soon as it comes back up again". Maybe it should have been called "@startup", but nonetheless it doesn't have a scheduled time and date when it runs. This is all just assuming standard Vixie cron, of course. I don't know what other cron replacements do.
For your info the times listed for the @reboot mean nothing as reboot is not a timed event.

Also remember this is on the machine to wake-up or start-up.

For example, if we wanted to have the system date written in a file called date.txt when Linux restarts, we would add the following string:

@reboot date >> ~/date.txt

Some url's that may help you understand.

Code: Select all

https://phoenixnap.com/kb/crontab-reboot

https://www.cyberciti.biz/faq/linux-execute-cron-job-after-system-reboot/
The computer that is going to give the "wake-up" only needs this command "sudo etherwake <mac address here>".
Hope this help's.
It is easier to fight for one's principles then to live up to them.

Post Reply

Return to “Hardware /Configuration”