rejetto forum

Software => HFS ~ HTTP File Server => HTML & templates => Topic started by: fire2050 on February 20, 2010, 06:58:48 AM

Title: Wake On Lan via a script?
Post by: fire2050 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

Title: Re: Wake On Lan via a script?
Post by: rejetto 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.
Title: Re: Wake On Lan via a script?
Post by: fire2050 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
Title: Re: Wake On Lan via a script?
Post by: rejetto 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.
Title: Re: Wake On Lan via a script?
Post by: Mars 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 ;)
Title: Re: Wake On Lan via a script?
Post by: fire2050 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
Title: Re: Wake On Lan via a script?
Post by: fire2050 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
Title: Re: Wake On Lan via a script?
Post by: fire2050 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
Title: Re: Wake On Lan via a script?
Post by: Mars 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  ;)


Title: Re: Wake On Lan via a script?
Post by: rejetto on February 22, 2010, 11:29:53 AM
exactly.
these commands are server-side, while "onclick" is for client-side.
Title: Re: Wake On Lan via a script?
Post by: fire2050 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
Title: Re: Wake On Lan via a script?
Post by: fire2050 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
Title: Re: Wake On Lan via a script?
Post by: rejetto 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?
Title: Re: Wake On Lan via a script?
Post by: fire2050 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
Title: Re: Wake On Lan via a script?
Post by: rejetto 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.}
Title: Re: Wake On Lan via a script?
Post by: zilexa on February 23, 2010, 11:27:03 AM
Before you spent more time on Wake On Lan, I'd like to share my experience:

I simply used this site:
http://mobile.wakeonlan.me/

It's fantastic, I know my hostname so I just saved my MAC address in Yahoo! Notepad.
Now I can wake up my pc from anywhere in the world. And this site is also very accessible on any mobile phone.


THE DOWNSIDE:
most modems/routers send a signal to every attached PC every now and then. Could be after 4 hours, after 8 hours or after 1 hour. This signal is ALSO interpreted as WOL signal. Thus your pc wil start up...

Its annoying, when I go to the bedroom at night and see a light burning.... the PC is on! but I shut it off!?
Or when you leave the home, come home and the PC was on all day or the whole week or whatever.

After a while I disabled WOL... since there is no solution for this. And it was more a gimmick feature for me.
Title: Re: Wake On Lan via a script?
Post by: fire2050 on February 24, 2010, 06:49:35 AM
zilexa, ive had no such problems with wake on lan...with this macro im doing essentially what that website did except without having to forward a port (as i mentioned previously my router blocked it anyway with the firewall on which is a no-go)

also the issue you were having...it sounds like your computer was set to wake on activity which is different...wake on lan has to have a special magic packet sent that is basically the mac address repeated or something

read this...http://www.sevenforums.com/general-discussion/21075-posible-wake-anything.html

i think its more bios related than windows 7/vista/xp etc related but still a place to start

again thanks for the help rejetto id rather have something like that instead of js... now i just need to figure out that whole combining with the iphone template and how to recognize the user agent of the iphone....im sure youll hear more from me
Title: Re: Wake On Lan via a script?
Post by: rejetto on February 24, 2010, 10:19:49 AM
i already saw the code to recognize the iphone on this forum.
anyway you need something like {.if|{.pos|iphone|{.header|user-agent.}.}
Title: Re: Wake On Lan via a script?
Post by: Mars on February 24, 2010, 12:59:30 PM
go to the board "HTML & templates"   and  put iphone inside the search field ;)
Title: Re: Wake On Lan via a script?
Post by: zilexa on February 24, 2010, 10:57:55 PM
Well I disabled everything in my BIOS to wake the pc, except PME... still the pc woke up randomly...
Title: Re: Wake On Lan via a script?
Post by: fire2050 on March 01, 2010, 04:16:57 AM
hmm...somethings def wrong bc its waking on activity or maybe its a setting within windows thats causing this