linux后台启动服务命令自己停止 nohup和&

简单的说,在启动命令最后加&,是后台启动,但是你的ssh连接工具断了 这个服务就停止了

例如 ./collector.linux -conf=/root/mongo-shake-v2.4.16/collector.conf &

在前面加上nohup可以解决

nohup ./collector.linux -conf=/root/mongo-shake-v2.4.16/collector.conf &
 

如果需要前台启动并打印日志

在命令加 -verbose参数

./collector.linux -conf=/root/mongo-shake-v2.4.16/collector.conf -verbose

Guess you like

Origin blog.csdn.net/qq_41890624/article/details/111038195