1、创建startup.sh文件
#!/bin/sh
nohup java -jar -server ./diit-spatial-analysis-scheduled.jar --spring.config.location=./application.yml&
echo $! > ./diit-spatial-analysis-scheduled.pid
2、创建stop.sh文件
#!/bin/sh
PID=$(cat ./diit-spatial-analysis-scheduled.pid)
kill -9 $PID
3、赋予startup.sh、stop.sh、jar文件执行权限
chmod +x startup.sh
chmod +x stop.sh
chmod +x diit-spatial-analysis-scheduledjar
4、防火墙开通端口
查看 firewalld 状态
systemctl status firewalld
开启 firewalld
systemctl start firewalld
开放端口
// --permanent 永久生效,没有此参数重启后失效
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=1000-2000/tcp --permanent
重新载入
firewall-cmd --reload
查看
firewall-cmd --zone=public --query-port=80/tcp
删除
firewall-cmd --zone=public --remove-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=9030/tcp --permanent