LinHES Forums
http://forum.linhes.org/

HOW TO: Create MythWebWelcome!
http://forum.linhes.org/viewtopic.php?f=11&t=18930
Page 1 of 1

Author:  mythman13 [ Mon Sep 08, 2008 2:22 pm ]
Post subject:  HOW TO: Create MythWebWelcome!

Jigawho and myself have been creating a small web page on a DD-WRT enabled router to wakeup a MythBox ( http://knoppmyth.net/phpBB2/viewtopic.p ... 73&start=8 ) so that it can be accessed remotely for using MythWeb (or SSH etc.). Hopefully in time it can be adapted to power off the MythBox as well when you've finished using it.

To enable it, paste the following code in the command window (administration -> commands) on a DD-WRT mini distribution:
Code:
mkdir /tmp/www/cgi-bin
cd /tmp/www/cgi-bin
echo "# !/bin/sh" > mythbox.cgi
echo "/usr/sbin/wol -p 7 -h 192.168.1.255 00:11:22:AA:BB:CC" >> mythbox.cgi
echo "echo \"<html><body><p>MythBox has been woken up, please wait for it to boot up!</p><p>Then click here to navigate to it: <a href=http://mythweb.address.here/>MythBox Home Page</a></p></body></html>\"" >> mythbox.cgi
chmod +x mythbox.cgi

and click save startup. N.B.: second echo is one line until the third echo command and the last echo is all one line until the chmod command.

Navigate to http://router.ip.address.here/user/cgi-bin/mythbox.cgi and the page should load fine waking up your MythBox.

As this is html it can be easily expanded BUT the page must be small (only a few hundred KB MAX) to fit onto the router's memory (4MB min). So I'd invite anyone with html experience to please make it better!

Author:  jigawho [ Mon Sep 08, 2008 6:41 pm ]
Post subject: 

I'd just like to say that mythman13 has done all the work, I've just been asking questions...

Author:  mythman13 [ Tue Sep 09, 2008 4:33 am ]
Post subject:  update

jigawho wrote:
I'd just like to say that mythman13 has done all the work, I've just been asking questions...

In fairness, if you hadn't asked those questions I would never have created such a page!

I've updated this to make the startup script smaller and more manageable:
  1. SSH into your device and create the following file under /jffs: mythbox.cgi:
    Code:
    # !/bin/sh
    /usr/sbin/wol -p 7 -h 192.168.1.255 00:11:22:AA:BB:CC
    echo "<html><body><p>MythBox has been woken up, please wait for it to boot up!</p><p>Then click here to navigate to it: <a href=http://mythweb.address.here/>MythBox Home Page</a></p></body></html>"
    You can use vi: enter: /bin/vi /jffs/mythbox.cgi, press i to edit, then ESC to exit and tpe ZZ to save and exit (case sensitive).
  2. Chmod this script to make it executable:
    Code:
    chmod +x /jffs/mythbox.cgi
  3. Remove any of the previous entries in the startup script box under the web administration page and enter the following instead:
    Code:
    mkdir /tmp/www/cgi-bin
    cp /jffs/mythbox.cg /tmp/www/cgi-bin/mythbox.cgi
    This should reduce the amount of processing the device has to do when it first switches on!

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/