【发布时间】:2017-02-24 00:32:10
【问题描述】:
我使用这个 Spring Boot Maven 插件配置将我的 Spring Boot 应用程序构建为可执行文件:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
然后我创建了以下 systemd 单元文件来创建服务:
[Unit]
Description=ss7tm
After=syslog.target
[Service]
User=root
PIDFile=/var/run/ss7tm.pid
ExecStart=/root/ss7-1.0-SNAPSHOT.jar -Djava.security.egd=file:/dev/./urandom
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
但是当应用程序启动时,文件 /var/run/ss7tm.pid 并没有被创建。
怎么了?我正在使用 Spring Boot 1.3.5
【问题讨论】:
-
您是否以 root 身份运行您的应用程序?
-
是的,User=root in [Service]
标签: java linux spring-boot pid systemd