您的位置 首页 linux配置文件

systemctl 案例-java 程序

systemctl java

 

service:

cat /usr/lib/systemd/system/gzm_eres.service

[Unit]
Description=GuangZhou Metro`s Eres service[prod] for java
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
ExecStart=/home/liuw/gzm/script/eres/start.sh
ExecStop=/home/liuw/gzm/script/eres/stop.sh
PrivateTmp=true

[Install]
WantedBy=Multi-user.target

 

cat /home/liuw/gzm/script/eres/start.sh

 

#!/bin/bash
source /etc/profile
#nohup java -jar -server /home/liuw/gzm/eres-1.0.0-SNAPSHOT.jar > /dev/null &
LOG_HOME=/mnt/vdb/log/gzm/eres  
java  -Dspring.profiles.active=prod   -jar /home/liuw/gzm/eres-service-1.0.0-SNAPSHOT.jar > /dev/null &
echo $! > /var/run/gzm_eres.pid

cat /home/liuw/gzm/script/eres/stop.sh

#!/bin/bash

PID=$(cat /var/run/gzm_eres.pid)
kill -9 $PID

 

欢迎来撩 : 汇总all

白眉大叔

关于白眉大叔linux云计算: 白眉大叔

热门文章