由于做测试,需要临时配置一个域名和ip,这里是在openwrt中的dnsmasq配置:
在/etc/dnsmasq.conf 中添加下面一行
address=/dp-srv-1.sharekernel.com/192.168.13.197
然后重启dnsmasq就可以让内网对dp-srv-1进行解释了,不用每台机器都在hosts里面添加。
标签: openwrt
检测端口的守护进程
由于要定时检查某个程序是否一直占用某个端口,如果没有占用就重新执行该程序。这里写了个简单的shell来判断。这里以openwrt上执行gae为例:
#! /bin/sh
# feature :check tcp port 8087 alive
# author :comet
# created time :2013-08-20 16:38:00
APPPORT=`netstat -ant|grep :8087`
APPCMD="python /root/gaeclient/proxy.py &"
#echo ${APPPORT}
if [ -z "${APPPORT}" ]
then
${APPCMD}
fi