From 5c2eb193a323f384544e2a10994571c3d785089b Mon Sep 17 00:00:00 2001 From: wangyu- Date: Sun, 24 Jun 2018 06:49:32 +0800 Subject: [PATCH] =?UTF-8?q?Created=20=E8=BF=9B=E7=A8=8B=E4=BF=9D=E6=B4=BB?= =?UTF-8?q?=20(markdown)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 进程保活.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 进程保活.md diff --git a/进程保活.md b/进程保活.md new file mode 100644 index 0000000..219f16d --- /dev/null +++ b/进程保活.md @@ -0,0 +1,28 @@ +介绍一种简单方法,保证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 +``` + +即可达到目的 \ No newline at end of file