0
进程保活
wangyu- edited this page 2018-06-24 06:49:32 +08:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

介绍一种简单方法保证udp2raw在被杀掉/意外退出后,可以自动重新启动

创建run.sh

把以下内容保存为 run.sh

#! /bin/sh
while true
   do
   $@
   sleep 1
done

运行chmod 755 run.sh

通过run.sh执行udp2raw

以后通过run.sh来执行udp2raw比如原本你的udp2raw命令是

./udp2raw_amd64 -s -l0.0.0.0:4096 -r 127.0.0.1:7777  -a -k "passwd" --raw-mode faketcp

现在改成:

./run.sh ./udp2raw_amd64 -s -l0.0.0.0:4096 -r 127.0.0.1:7777  -a -k "passwd" --raw-mode faketcp

即可达到目的