我执行我的bash脚本PLCCheck的过程bash脚本UPD错误
./PLCCheck &
PLCCheck
while read -r line
do
...
def_host=192.168.100.110
def_port=6002
HOST=${2:-$def_host}
PORT=${3:-$def_port}
echo -n "OKConnection" | netcat -u -c $HOST $PORT
done < <(netcat -u -l -p 6001)
它侦听UDP端口6001
当我要执行我的第二bash脚本SQLCheck作为侦听UDP端口4001的进程
./SQLCheck &
SQLCheck
while read -r line
do
...
def_host=192.168.100.110
def_port=6002
HOST=${2:-$def_host}
PORT=${3:-$def_port}
echo -n "OPENEF1" | netcat -u -c $HOST $PORT
done < <(nc -l -p 4001)
我得到这个错误:
Error: Couldn't setup listening socket (err=-3)
端口6001和4001都在iptables的开放,这两个脚本的工作作为一个单一的过程。为什么我会得到这个错误?
嗯......两者都使用默认端口6002,但我看不到“PCLCheck”脚本中使用了“PORT”。也许他们碰撞... – TrueY 2014-10-20 08:50:56
对不起。 'netcat -u -c $ HOST $ PORT'也是一样。 PLCCheck每5分钟发送一次。 SQLCheck每120-300分钟随机发送一次。 – Philipp88 2014-10-20 08:58:32
尝试在两个脚本的开始处使用'set -x',并将它们作为前台进程在两个终端中启动,以查找出现此错误消息的行。根据你的部分脚本,它可以在任何行... – TrueY 2014-10-20 09:09:26