wcs服务
[Unit]
Description=WCS Java App
After=network.target
[Service]
Type=simple
Restart=on-failure
RestartSec=5
ExecStart=nohup java -Xmx2g -Xms2g -jar /home/wcs/dhwcs3.0-1.0.0.jar --server.port=8090 > /dev/null 2> msg.log &
[Install]
WantedBy=multi-user.target
WMS服务
[Unit]
Description=WCS Java App
After=network.target
[Service]
Type=simple
Restart=on-failure
RestartSec=5
ExecStart=nohup java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=38199 -Xmx2g -Xms2g -jar /home/wms/dhwms2.0-1.0.0.jar --spring.profiles.active=dev > /dev/null 2>msg.log &
[Install]
WantedBy=multi-user.target
将上述文件保存为wcs.service 和wms.service,放置于 /etc/systemd/system
1.重新加载服务
systemctl daemon-reload
2.启动服务
systemctl start wms
systemctl start wcs
3.设置自启动
systemctl enable wms
systemctl enable wcs
4.查看java运行情况
ps aux |grep java