Author Topic: Wake On Lan via a script?  (Read 4248 times)

0 Members and 1 Guest are viewing this topic.

fire2050

  • Guest
Wake On Lan via a script?
« on: February 20, 2010, 06:58:48 AM »
So heres a thinker...

Is there a way (through scripting or something) i could wake up my other computer using Wake On Lan

I know about wake on internet but my routers firewall blocks it and i would prefer to have a link i click that sends the magic packet to wake up the other computer

This seems like it would be a pretty simple function that could be easily added to any template


Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12953
    • View Profile
Re: Wake On Lan via a script?
« Reply #1 on: February 20, 2010, 06:40:22 PM »
that's not something to demand to the application level.
it's at system level, it should be provided by the operating system and drivers.

fire2050

  • Guest
Re: Wake On Lan via a script?
« Reply #2 on: February 21, 2010, 02:25:44 AM »
I guess I was a little unclear...let me explain what im trying to do

So I have a laptop thats always on and a secondary server/media center computer

What I would like to do is be able to remotely wake up the server via a link that i click online

I plan to use HFS on both (listening at different ports)

The secondary pc is already equipped with and currently working with wake on lan

I was thinking...would it be possible to execute like a command line sort of think via a link?

Hopefully this makes sense...and thanks for the reply rejetto not too often the main dev replies

Love the program

Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12953
    • View Profile
Re: Wake On Lan via a script?
« Reply #3 on: February 21, 2010, 12:42:15 PM »
yes, it can be done.
you start telling me what you do to remotely wake the other computer, and i'll tell you more.

Offline Mars

  • Operator
  • Tireless poster
  • *****
  • Posts: 1899
    • View Profile
Re: Wake On Lan via a script?
« Reply #4 on: February 21, 2010, 10:30:41 PM »
a possible way is to use an external program which can wake up the remotly computer, an use the macro exec associated with the link ;)

you must activate the lan wake up in the remote computer bios

The invited computer has to send a package of numeric(digital) signals to the host via the network.

open a DOS session on your remote computer and use the command 'getmac' to find the distant_mac_address

The software is a program (coming of: http://www.sysworksoft.net/products/rw.html) MS-DOS very simple to manipulate. He is to be put on the invited PC.

Use the following command: rw / m:distant_mac_address
rw /m :01-05-FD-3E-XX-YY

You can save rw.exe inside the HFS.exe folder

{.exec|rw /m :01-05-FD-3E-XX-YY|timeout=value.}

rejetto will explain more: where and how using  thos informations ;)
« Last Edit: February 21, 2010, 10:44:38 PM by Mars »

fire2050

  • Guest
Re: Wake On Lan via a script?
« Reply #5 on: February 22, 2010, 04:11:55 AM »
yes! that is perfect

currently i have wake on lan working (i have an app on my iphone that can start it if im too lazy to walk to the other room)

i will play around with this and report back

thanks for all your help

fire2050

  • Guest
Re: Wake On Lan via a script?
« Reply #6 on: February 22, 2010, 04:30:53 AM »
the only problem im having is how do i incorporate this into a template that when you click on a link it executes the macro

Offline fire2050

  • Occasional poster
  • *
  • Posts: 11
    • View Profile
Re: Wake On Lan via a script?
« Reply #7 on: February 22, 2010, 05:11:33 AM »
ok i figured out what my problem was at first

i needed to close it with a .} instead of just }

this is what ive come up with

<a href="http://%host%:443" onclick="{.exec| rw.exe /m:0016e64520d6.}">Secondary Server</a>

however, it executes the macro on each load of the website which i would prefer not to happen

also ideally a dialog box popping up saying like wait 5 seconds would be nice

and what i eventually would like to do would be have it say

Secondary Server: Online or Offline....via some macro that queries the other computer to see if it is online with maybe another link that you would click to wake up the computer?

sorry for all the posts back to back

Offline Mars

  • Operator
  • Tireless poster
  • *****
  • Posts: 1899
    • View Profile
Re: Wake On Lan via a script?
« Reply #8 on: February 22, 2010, 08:06:36 AM »
Quote
however, it executes the macro on each load of the website which i would prefer not to happen

all macros are executed by hfs before sending the final web page

the link to use is

<a href="http://%host%:443/~wakeup">Wake-Up Secondary Server</a>


put your macro inside a section named in the template

[wakup]
<html>
Wait until server wake-up
</html>
{.exec| rw.exe /m:0016e64520d6.}



it is the simplest formulaton  ;)


« Last Edit: February 22, 2010, 08:09:35 AM by Mars »

Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12953
    • View Profile
Re: Wake On Lan via a script?
« Reply #9 on: February 22, 2010, 11:29:53 AM »
exactly.
these commands are server-side, while "onclick" is for client-side.

Offline fire2050

  • Occasional poster
  • *
  • Posts: 11
    • View Profile
Re: Wake On Lan via a script?
« Reply #10 on: February 22, 2010, 10:41:42 PM »
awesome...thanks so much

you had a typo tho in yours...for future reference others can just cut and paste this

========================

[wakeup]
<html>
Wait until server wake-up
</html>
{.exec| rw.exe /m:0016e64520d6.}

#change the red text to your mac address, also rw.exe has to be in the same folder as hfs.exe

=========================

#then create a link somewhere you like with this text

<a href="http://%host%/~wakeup">Wake-Up Secondary Server</a>

#the 443 port is where the secondary server listens

#you would then need a link like

<a href="http://%host%:443/">Secondary Server</a>

#to visit the secondary server

Offline fire2050

  • Occasional poster
  • *
  • Posts: 11
    • View Profile
Re: Wake On Lan via a script?
« Reply #11 on: February 22, 2010, 10:54:06 PM »
now, my question is....can you maybe create a countdwon on the page that it generates? or perhaps a dialog box that counts down?

maybe also combining it so that i dont have several links cluttering things? like into one of the side frames on the teryaon skin?

ive uploaded a screen shot of my skin and intend to post the modified version once i get the way i like

thanks again for all of your help

Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12953
    • View Profile
Re: Wake On Lan via a script?
« Reply #12 on: February 22, 2010, 11:35:22 PM »
sure, a count down can be done, in javascript.
it is not related to the server features.
what are you counting exactly?

Offline fire2050

  • Occasional poster
  • *
  • Posts: 11
    • View Profile
Re: Wake On Lan via a script?
« Reply #13 on: February 23, 2010, 04:15:03 AM »
just like when you clicked the link it would say

Please wait for the server to boot...5...4..3..2..1 and then load the servers page

should be pretty simple but html and macros are a stretch for me...so js seems scary

Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12953
    • View Profile
Re: Wake On Lan via a script?
« Reply #14 on: February 23, 2010, 10:38:24 AM »
i have no time to make the visible countdown, but this should work (untested)

[wakeup]
<html>
<head>
<meta http-equiv="refresh" content="5; url=http://%host%:443/">
</head>
<body>
Wait until server wake-up
</body>
</html>
{.exec| rw.exe /m:0016e64520d6.}
« Last Edit: February 23, 2010, 10:41:04 AM by rejetto »