Need help with iptables rules for my wireless router running dd-wrt.
Have a bridge (br1) setup with eth0 and vlan2 assigned to it. No internet (WAN).
br1 IP = 192.168.3.1, 255.255.255.0
eth1 = wireless interface (br1)
vlan2 = wired LAN port #1 (br1)
webserver = 192.168.3.120:80 (wired to vlan2)...
Hmmm.... then i wonder if something like the following would be better at waiting for an event....
nc -l -u localhost 2222 | while read line; do
echo "Hey its $line"
./runMyScript.bash
done
Is there perhaps a better way to wait for text to come across port 2222 and and when it does, do...
Which taxes my cpu more.....
while :; do
echo "hello world"
done
OR
while :; do
echo "hello world"
sleep 1
done
just curious. sorry if its painfully obvious and i'm just a dolt.
From the dd wiki....
image a partition to another machine:
On source machine:
dd if=/dev/hda bs=16065b | netcat < targethost-IP > 1234
On target machine:
netcat -l -p 1234 | dd of=/dev/hdc bs=16065b
Should lead you in the right direction. Hope this helps.
O.k. thanks. Yes, seems nc still runs. So, I've updated my listen3333.sh script to the following and it is behaving like I want it to.....
#!/bin/sh
while :; do
nc -l -u -p 3333 | while read INPUT; do
date >>/tmp/log.txt
echo "$INPUT" >>/tmp/log.txt
killall nc
done
done...
ok,
so I've created a new script called listen3333.sh and contains.....
#!/bin/sh
while :; do
nc -l -u -p 3333 | ./myscript.sh
done
and then make it executible...
chmod 755 listen3333.sh
myscript.sh contains....
#!/bin/sh
while read INPUT; do
echo "Input is $INPUT" | tee >>/tmp/log.$$...
Consider the following netcat command to listen on a port.....
sudo nc -l -u -p 3333 | myscript.sh
contents of myscript.sh is....
#!/bin/sh
while read INPUT; do
echo "Input is $INPUT | tee /tmp/log.$$
done
This waits for a connection on port 3333 and when a connection is made, data sent by...
I tried your suggestion, did not seem to work.
if myscript.sh contains this....
#!/bin/sh
echo "test" >newfile.txt
and I run...
sudo nc -u 192.168.1.100 2222
"type some text and hit enter"
then it works. a new file called "newfile.txt" is created which contains the string "text".
However...
i have xinetd setup to run myscript.sh whenever some text is sent to port 2222.
but i'm needing to pipe the text into myscript.sh
example:
- client sends string "11111" to server port 2222
- myscript.sh is executed with "11111" as the first argument.
can this be done?
thanks for any help.
i have a digital signage device that uses upd to communicate.
I got it working. To use udp for a service, there are two required lines in /etc/xinetd.d/myscript ....
socket_type = dgram
wait = yes
default settings are:
socket_type = stream
wait = no
So here's my...
hmmm, I think xinetd is what i'm after. I just want to run myscript.sh when some text is sent to port 3333, using UDP.
so i installed xinetd from my repos and added the following line to /etc/services
myscript 3333/udp
created the file /etc/xinetd.d/myscript and it contains...
service...
is there an efficient way to fire off a shell script each time netcat receives new text string from a network port?
i need root to run myscript.sh each time a new string of text is received from port 3333. also, capture the string as a variable in myscript.sh.
thanks for any help.
m
FWIW, a hack that made it work.....
in my.php...
<?php
$result = shell_exec("getImageURL.bash");
?>
<img src="<php echo $result ?>" />
basically, my .bash script decides the next image to display, in this example /images/image1.jpg and THEN copies it to /temp/image1.jpg
the string...
my.php file runs whenever a jpeg file is requested. The directive looks like....
<Directory "/opt/lampp/htdocs/images/">
AddHandler image/jpeg .jpg
Action image/jpeg /opt/lampp/cgi-bin/my.php
</Directory>
again, this works, however, the jpeg image does not display in the browser. I need my.php...
i need my php script to exectute once a file has been requested/downloaded by anyone. I'm new to apache config. Perhaps there's a directive for this? thanks for any help.
Could you instead use a bootable CD/DVD??
Your Red Hat Repositories *should* have a package for you to install called mklivecd. It creates a bootable liveCD or DVD of your currently installed Red Hat system.
If it does, install it. Quite easy to use.
Hope this helps.
Seems the only way that I can read ascii text coming accross /dev/ttyS0 is with a gui-type of serial console.
I need to do this with a shell script similiar to...
#!/bin/sh
cat /dev/ttyS0 > myFile.txt
...putting the output into a text file. Like I said, only gui programs seem to work. I guess...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.