本帖最后由 来学习 于 2023-9-22 14:38 编辑
感谢大佬们帮忙转下- #!/bin/bash
- #chown -R www:www /data/www
- export JAVA_HOME=/usr/java/jdk1.8.0_92
- ulimit -SHn 65535
- ulimit -c unlimited
- if test `jps | grep -c "gamebase"` = 0
- then
- ntpdate us.pool.ntp.org >/dev/null 2>&1 &
- fi
-
- servperm=384
- servmaxperm=512
- servmem=4096
- servmemhalf=2048
- cd gamejar
- nohup $JAVA_HOME/bin/java -server -Duser.timezone=Asia/Shanghai -XX:ReservedCodeCacheSize=256m -XX:MaxDirectMemorySize=1024m -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Dlog4j.rootpath=./ -Djava.security.policy=jstatd.all.policy -Djava.rmi.server.hostname=127.0.0.1 -Dcom.sun.management.jmxremote.port=9602 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.EPollSelectorProvider -Xdebug -Xrunjdwp:transport=dt_socket,address=9502,server=y,suspend=n -Xms${servmem}m -Xmx${servmem}m -Xmn${servmemhalf}m -XX:PermSize=${servperm}m -XX:MaxPermSize=${servmaxperm}m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:+CMSClassUnloadingEnabled -XX:-CMSParallelRemarkEnabled -XX:CMSInitiatingOccupancyFraction=80 -XX:+CMSScavengeBeforeRemark -verbose:gc -XX:+Print**ateStamps -XX:+Print**etails -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCApplicationStoppedTime -Xloggc:./logs/gcserver.log -XX:+AggressiveOpts -XX:-OmitStackTraceInFastThrow -jar ./gamebase.jar >/dev/null 2>&1 &
- i=10
- while [[ $i != 1 ]]
- do
- sleep 10
- check_port() {
- netstat -tlpn | grep "\b$1\b"
- }
- SERVER_PORT1=31055 #端口1
- if check_port ${SERVER_PORT1}
- then
- i=1
- else
- echo "`date +%Y-%m-%d" "%H":"%M":"%S` 正在启动,请稍后···"
- fi
- done
- if [ $i = 1 ];then
- echo "`date +%Y-%m-%d" "%H":"%M":"%S` 启动完成"
- else
- echo "`date +%Y-%m-%d" "%H":"%M":"%S` 启动失败,请联系技术人员"
- fi
- sleep 3
复制代码
|