Support > Applications

[SOLVED] Help waking server with HDX1000 media player

(1/3) > >>

Stoke192:
Hi,
I've recently posted on the nmt forum regarding this and as it's a linux .cgi script i'm trying to get to work i thought someone here would also be able to help a noob out.


--- Quote ---Hi,
I've recently built myself a unRAID server and waking it up from my HDX would be the icing on the cake , So...Following on from this locked thread http://www.networkedmediatank.com/showthread.php?tid=18844
I'm having a few problems getting this script to work, it's posible i'm not saving it correctly as i'm a total linux noob.
I've tried saving my .cgi file in notepad, wordpad (selecting unicode) and notepad++ but that only gives me the option to save as a (unix script .sh, .bsh)
I seem to only be able to save the file as NAS-start.cgi.txt.

I've installed Telnetd via the CSI and when i enter the command 'ether-wake -b 00:1B........' my server will wake up no problem.

I enter the command './NAS-start.cgi' i get a file not found error.

If i enter 'NAS-start.cgi.txt i get this....

--- Code: ---/opt/sybhttpd/localhost.drives/HARD_DISK # ./NAS-start.cgi.txt
: not found.cgi.txt: line 1: ÿþ#!/bin/sh
: not found.cgi.txt: line 2:
: not found.cgi.txt: line 3:
: not found.cgi.txt: line 4:
: not found.cgi.txt: line 5:
: not found.cgi.txt: line 7: {
Magic Packet Send...
: not found.cgi.txt: line 11: }
: not found.cgi.txt: line 12:
: not found.cgi.txt: line 13:
: not found.cgi.txt: line 15: {
Content-Type: text/html

 <html>
 <head>
 <title>
 NAS WOL started
 </title>
 </head>
 <body>

 EOF
 }

 end_html()
{
    cat <<EOF
 </body>
 </html>
 EOF
 }
 start_html
 start
 end_html

--- End code ---

I've also set up the web service as per instructions, (url: http:\\localhost.drives:8883\HARD_DISK\NAS-start.cgi) an i get an error 'Request cannot be processed'

Anyway, here's my NAS-start.cgi file ( i've edited path to busybox and mac addy accordingly)

--- Code: --- #!/bin/sh
 
MARKER="#M_A_R_K_E_R_do_not_remove_me"


start()
 {
     echo -n "Sending MP to NAS"
     /opt/sybhttpd/localhost.drives/HARD_DISK/Apps/Telnetd/bin/busybox ether-wake -b 00:1B:........
     echo "Magic Packet Send..."
 }
 

start_html()
 {
     echo "Content-Type: text/html"
     echo ""
     cat <<EOF
 <html>
 <head>
 <title>
 NAS WOL started
 </title>
 </head>
 <body>
             
 EOF
 }
             
 end_html()
{
    cat <<EOF
 </body>
 </html>
 EOF
 }
 start_html
 start
 end_html
 
exit 0

--- End code ---

Any help would be very appreciated.

Thanks
--- End quote ---
   

Link to my thread : http://www.networkedmediatank.com/showthread.php?tid=61611

Link to original thread : http://www.networkedmediatank.com/showthread.php?tid=18844

Any help would be very appreciated

Thanks

Stoke192:
Ok, i think i'm getting somewhere....

This is the script i'm trying to use :

--- Code: ---#!/bin/sh
 
MARKER="#M_A_R_K_E_R_do_not_remove_me"


start()
 {
     echo -n "Sending MP to NAS"
     /opt/sybhttpd/localhost.drives/HARD_DISK/Apps/Telnetd/bin/busybox ether-wake -b 00:1B:21:72:22:4C
     echo "Magic Packet Send..."
 }
 

start_html()
 {
     echo "Content-Type: text/html"
     echo ""
     cat <<EOF
 <html>
 <head>
 <title>
 NAS WOL started
 </title>
 </head>
 <body>
             
 EOF
 }
             
 end_html()
 {
    cat <<EOF
 </body>
 </html>
 EOF
 }
 start_html
 start
 end_html
 
exit 0

--- End code ---

but when i enter the command ./NAS-start.cgi via telnet i get a error message line 41: syntax error: unexpected end of file (expecting "}")

Any idea's guy's

Thanks

Joe L.:
first, you probably have embedded MS-DOS style carriage-returns...

but more importantly...

unless you installed "busybox" on your unRAID server, it does not exist...  Therefore, any attempt to invoke it will fail.

this:
/opt/sybhttpd/localhost.drives/HARD_DISK/Apps/Telnetd/bin/busybox
does not exist on unRAID.

Stoke192:
Hi,
Thanks for the reply,


--- Quote from: Joe L. ---first, you probably have embedded MS-DOS style carriage-returns...
--- End quote ---

Ok, How do i save the said .cgi file so it'll work on my NMT ?

I'm trying to run this script from my HDX to wake my server, i didn't think you needed busybox installed on your server for it to work.(it is installed on my HDX)

If i enter the command ether-wake -b 00:1B...... using Putty to telnet into my HDX, my server wakes without any probs.

Now, when i try to run the script via telnet using the command ./NAS-start.cgi on my HDX i get the above syntax error.

I appologise if i'm talking rubbish, but i'm only following the instructions in the nmt forum thread i linked to in my first post, it works for some people but not others.

I was asking really if anyone could see any glaring errors in the above script the would give the syntax error i've posted, as both the server and HDX use the same OS, as i've not got a clue what i'm looking at.

Any help very much appreciated.

Thanks

Stoke192:
I've opened my NAS-start.cgi file in Notepad++ and selected the option to view 'end of lines' and all the lines have'LF' after them, is this correct ?

Thanks

Navigation

[0] Message Index

[#] Next page

Go to full version