4015 发表于 2024-9-15 15:59:56

自动重起游戏 自动重起 服务器 代码


雷霆传奇H5 自动重起游戏 自动重起 服务器 代码


付费主题, 价格: 5 金币



重起服务器#!/bin/bash
#检查9004端口是否被占用,如果占用睡眠1秒,如果没有被占用执行run.sh
pid=`/usr/sbin/lsof -i :9004|grep -v "PID" | awk '{print $2}'`
if [ "$pid" != "" ];
then
   sleep 1
else
   bash /sbin/reboot    reboot
fi

端口自己改。。。


重起游戏
#!/bin/bash
#检查9001端口是否被占用,如果占用睡眠1秒,如果没有被占用执行run.sh
pid=`/usr/sbin/lsof -i :9001|grep -v "PID" | awk '{print $2}'`
if [ "$pid" != "" ];
then
   sleep 1
else
   bash /www/888/www/wwwroot/server   
      cd /www/888/www/wwwroot/server/s1 && ./run.sh
fi






页: [1]
查看完整版本: 自动重起游戏 自动重起 服务器 代码