So, there's no need for killing httpd
You just need to start one.... _________________ Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge
Yes, not needed.
But at that moment I wrote that I was in the process of rewriting someone else's code and already changed a lot of its concept.
That wasn't the latest anyhow
_________________ Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge
Hnestly, you don't even need to waste CPU resources to get rid off the trailing ^M. The awk '{print \0.0.0.0\"\\\t\"\$2}' I showed you on my post above automatically takes care of this mainly because this ^M isn't part of variable $2. _________________ Mazi
UK non-geo DID #: +447031942574
Although ^M is not part of that variable, it will get added because it's part of the carriage return line feed combo
[edit]
Before putting it on my router, I'm testing it on my Fedora-system. These ^M appear there, but not on my router. I guess the awk of busybox already translates them. I'm keeping it in for the sake of portability and it might change in the future.
Do not only look at the script, but inspect the result as well. (and you have a missing double quote) _________________ Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge
I have pixelserv running on 192.168.10.5 (on another server).
You can use DD-WRT as well if you are willing to change the port of DD-WRT's webinterface.
You should do the following:
Code:
nvram set http_lanport=88
nvram commit
reboot
Go to the webinterface (http://192.168.1.1:88)
Administration -> Commands
and replace rogue=192.168.10.5 with these 2 lines:
Code:
rogue=192.168.1.1
httpd -h /usr/tmp/www
_________________ Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge
Although ^M is not part of that variable, it will get added because it's part of the carriage return line feed combo
When you instruct awk to print with the variable $2 (hostname), it will ONLY print that variable (hostname) without the ^M character or the comments after the variable $2 (hostname) and so forth. It is as simple as that and nothing is hidden with such a print statement.
Quote:
I guess the awk of busybox already translates them.
No. Unless instructed to do so, awk never translates such a character (see my explanation above). In your code, you didn't ask awk to translate any characters. As a matter of fact, you just instructed awk to print variables $1, a \t (tab), and $2. _________________ Mazi
UK non-geo DID #: +447031942574
I suppose /etc/hosts hack won't be able to stop the ads from flash, will it? How about pop-up ads? _________________ Mazi
UK non-geo DID #: +447031942574
I guess the awk of busybox already translates them.
No. Unless instructed to do so, awk never translates such a character (see my explanation above). In your code, you didn't ask awk to translate any characters. As a matter of fact, you just instructed awk to print variables $1, a \t (tab), and $2.
Maybe you should "explain" less and read more.
You are looking at the old code. I'm not using print $1 anymore and I wouldn't have used it if I would have written the initial code.
I'm now instructing awk to only print this:
Code:
awk '{print \"$rogue\\\t\"\$2}'
rogue will be translated in the script (it's a script writing a script), so it's the same as your code (only yours is missing a double quote.
To my surprise this wasn't the case on the DD-WRT router.
Your remark about the print $1 was good.
I've tested your script. You apparently didn't. _________________ Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge
While pixelserv is ok I prefer to keep all functionality just on the router and not dependent on another pc I need to keep running (and yes I have multiple linux box's available)...so the change to use the router's IP was most appreciated
Not everyone is able to run pixelserv and if you don't care that your router's webserver runs on port 88 instead of port 80, you can use the following code.
Put this in your startup code.
B E W A R E your router will only be accessible on port 88
_________________ Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge
Thanks for the updated script frater. It worked like a champ. Question...since we already have the script checking every xx seconds to see if the hosts need updating could it also check if httpd is running on port 80 and restart it if necessary? I've had some isolated cases where it appears to have died with no warning.
Question...since we already have the script checking every xx seconds to see if the hosts need updating.
I'm sorry to tell you that it doesn't. There is a loop, but this one is only there to be sure the file is actually downloaded.
After the download succeeds it will tell DNSMASQ to reload its settings and stop.
This is all deliberate... _________________ Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge
I guess the awk of busybox already translates them.
No. Unless instructed to do so, awk never translates such a character (see my explanation above). In your code, you didn't ask awk to translate any characters. As a matter of fact, you just instructed awk to print variables $1, a \t (tab), and $2.
Maybe you should "explain" less and read more.
Outch! Perhaps, you should test more before you post here! My reference above pointed to your comments on ^M and not about $1. Although I didn't have to be specific (unless I deal with mentally challenge and/or under-achieve folks), I posted to tell you that printing variable $2 on a DDWRT router, not on a Linux computer, will automatically get rid off the control ^M character! This very statement of yours Maybe you should "explain" less and read more will apply to you better, in this case. ;)
BTW, your latest scripts still show the use of tr -d '\015' to get rid off the control ^M characters that only wastes your router CPU resources. _________________ Mazi
UK non-geo DID #: +447031942574
If there ever was a waste of CPU-cycles it was the script staying in memory and reloading every time. I There is little to no impact whatsoever...
I wrote and tested the script on my linux-box and there I needed to kill the ^M. Because of your statement that it was not needed, I checked it again and also tested it on the router with that filter. Indeed, it is not necessary on the router, but I want the script to be portable and if somehow the behaviour of busybox changes I don't want to suddenly end up with a waste of space with superfluous ^M and maybe erratic behaviour.
BTW... I said this already in a previous post.
In your copy paste sequence you ended up with a syntax error which you never corrected, so your line became:
Code:
awk '{print .0.0.0"\t"$2}'
instead of
Code:
awk '{print "0.0.0.0\t"$2}'
Why are you avoiding that?
Too specific perhaps? _________________ Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge
Question...since we already have the script checking every xx seconds to see if the hosts need updating.
I'm sorry to tell you that it doesn't. There is a loop, but this one is only there to be sure the file is actually downloaded.
After the download succeeds it will tell DNSMASQ to reload its settings and stop.
This is all deliberate...
If you put this in /jffs/check_http
Code:
#!/bin/sh
cd /tmp
while true
do
sleep 300
wget -q http://`nvram get lan_ipaddr`:`nvram get http_lanport`
if [ ! -e index.html ]; then
stopservice httpd
startservice httpd
else
rm index.html
fi
done
and this in startup:
Code:
/jffs/check_http &
Your webserver will be checked every 5 minutes and restarted if it has crashed. _________________ Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge