我们可以定义系统环境变量来表示 在/etc/profile 最后一行增加
export JAVA_OPTS='-Djava.rmi.server.hostname=192.168.2.39 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false'
然后 source /etc/profile 是文件生效。
启动时我们就可以用 nohup java $JAVA_OPTS -jar /root/app/data-center-0.0.1-SNAPSHOT.jar --spring.profiles.active=dev >nohup 2>&1 & 这个脚本。