使用 Tee 和 Named Pipe, Screen 进行

这两天突然想用journalctl来管理Minecraft日志。

使用Sytemd启动Minecraft服务器,不以Fork的形式,而是直接作为一个Simple的服务进行管理,同时使用journalctl管理 Minecraft 服务器日志。

然而为了能正确关闭服务器,并且进行一些配置,还是需要一个脚本进行管理。这个脚本需要在启动的时候直接吧Minecract Server(也就是Java)的标准输出直接输出出来,同时管理员要能再 attach 到 Minecraft 服务器上

 

大意如下:

Daemon.sh

#!/bin/bash
screen -dmS “test” /bin/bash -c “cd ; ./echh.sh | tee ./test.fifo”
cat ./test.fifo

 

Leave a Reply

Your email address will not be published. Required fields are marked *