June 5, 201214 yr 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. 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.... /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 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) #!/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 Any help would be very appreciated. Thanks 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
June 5, 201214 yr Author Ok, i think i'm getting somewhere.... This is the script i'm trying to use : #!/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 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
June 5, 201214 yr 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.
June 5, 201214 yr Author Hi, Thanks for the reply, first' date=' you probably have embedded MS-DOS style carriage-returns...[/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
June 5, 201214 yr Author 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
June 5, 201214 yr 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 Yes, that sounds correct. I might be confused though... Are you trying to run this script on your medis player? Or on the unRAID server? (busybox probably does exist on your media player) To invoke a shell script in verbose mode, usually you can invoke it as sh -xv path/to/script... It will show you the lines as they are evaluated. Odds are you have a syntax error. Hopefully, it will show you the line with the error. Joe L.
June 6, 201214 yr From his thread i would say he tries to wakeup his server from his HDX1000 Media Player. In that case you should first try to wake your server fron any PC in your network to see if it wakes up. If it wakes up, than it is not a failure in unRaid, but in the script you use on the HDX1000. Therefore a forum specializes in the HDX1000 would be a better place to get that stuff running, because than it has nothing to do with unRaid itself. Althought there are some different approches to achieve this mainly in german Forums. It also differs if you want to be able to onlay wake the server on boot, or also when the HDX ist running. Here are some thread from the german forums, maybe the Google transloator can help: http://www.popcornforum.de/showthread.php?tid=1841&page=6 http://www.popcornforum.de/showthread.php?tid=12018&pid=175309#pid175309 If busybox is installed, starting the Server when the HDX is started should be simple by adding suche a line to the start_app.sh (dont ask me where you find that file on the HDX, because i dont have such a player at home): /share/Apps/Busybox/bin/busybox ether-wake aa:bb:ccd:ee:ff
June 16, 201214 yr Author From his thread i would say he tries to wakeup his server from his HDX1000 Media Player. In that case you should first try to wake your server fron any PC in your network to see if it wakes up. If it wakes up, than it is not a failure in unRaid, but in the script you use on the HDX1000. Therefore a forum specializes in the HDX1000 would be a better place to get that stuff running, because than it has nothing to do with unRaid itself. Althought there are some different approches to achieve this mainly in german Forums. It also differs if you want to be able to onlay wake the server on boot, or also when the HDX ist running. Here are some thread from the german forums, maybe the Google transloator can help: http://www.popcornforum.de/showthread.php?tid=1841&page=6 http://www.popcornforum.de/showthread.php?tid=12018&pid=175309#pid175309 If busybox is installed, starting the Server when the HDX is started should be simple by adding suche a line to the start_app.sh (dont ask me where you find that file on the HDX, because i dont have such a player at home): /share/Apps/Busybox/bin/busybox ether-wake aa:bb:ccd:ee:ff Hi, Thanks for taking the time to reply, I appreciate that there isn't a problem with unRAID it's self as it'll WOL via a MP from my PC without any probs, it was just that i was asking any of the linux guru's on here if they could see any probs with the script i posted as it was giving a syntax error. If it helps the HDX 1000 is essentially a PCH-A110 in a different case. Thanks
June 17, 201214 yr Author Hi, Can anyone tell me what this means #!/bin/sh: not found I get this error when i try to run the above script with the ./NAS-start.cgi Thanks
June 17, 201214 yr Hi, Can anyone tell me what this means #!/bin/sh: not found I get this error when i try to run the above script with the ./NAS-start.cgi Thanks The script is corrupted. The extra characters #!/bin/sh are supposed to indicate what shell would be used to interpret the script.
June 17, 201214 yr Author Ahh, i see.... I take it then i'm not saving it (the above script) correctly as the script works for some but not others, including me.....as you know. Or is it that the script itself is corrupt in some way ? Thanks
June 17, 201214 yr Ahh, i see.... I take it then i'm not saving it (the above script) correctly as the script works for some but not others, including me.....as you know. Or is it that the script itself is corrupt in some way ? Thanks you probably have ms-dos style carriage returns at the ends of the lines.
June 21, 201214 yr Author I managed to get this sorted after hours/days trawling the 'tinternet' and staring at the code (not knowing what i was looking at though), Anyway after staring at the script, and comparing the original with mine i noticed there was a extra column of spaces on the left side of the script when looking at it in notepad++.They must of been introduced when copying and pasting the script from the original forum post. I removed said spaces and voila!, working script...... NOTE!! to self, always check for extra spaces during copy and paste... Here's a copy of the working script so you'll see what i mean... #!/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 Sent..." } 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 Anyway, all is working how i want it and WOL from my HDX is the icing on the cake. Cheers
Archived
This topic is now archived and is closed to further replies.