0

我准备了要安装在 CentOS 上的 RPM 软件包。好像安装成功了。但是我无法启动它 - 它会引发 203 错误。 Process: 4574 ExecStart=/opt/vcs/cegp/dtm/my_service/my_service.jar (code=exited, status=203/EXEC)

父 pom 里面有一个 rpm 插件<build><pluginManagement>

    <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>rpm-maven-plugin</artifactId>
    <version>${plugin-rpm-maven.version}</version>
    </plugin>

它还有一个资源插件,可以复制所需的资源。所有这些似乎都在我需要它们的地方结束。实际代码和所有内容都放在子模块中,该模块具有所有依赖项、程序集插件等以及这个 rpm 插件:

<profile><id>rpm</id>
   <build>
<pluginManagement>
  <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>${plugin-rpm-maven.version}</version>
<executions>
<execution>
 <id>generate-rpm</id>
     <phase>install</phase> 
      <goals>
         <goal>rpm</goal>
  </goals>
 </execution>
</executions>
<configuration>
<license>...</license>
<version>${project.version}</version>
<group>Applications/System</group>
<name>${artifact-id}</name>
<defaultUsername>${rpm.username}</defaultUsername>
<defaultGroupname>${rpm.groupname}</defaultGroupname>
<vendor>...</vendor>
<distribution>rhel8</distribution>
<defaultDirmode>755</defaultDirmode>
<defaultFilemode>755</defaultFilemode>

<mappings>
<mapping>
  <directory>${rpm.service.file.directory}</directory>
   <directoryIncluded>false</directoryIncluded>
    <filemode>555</filemode>
    <username>root</username>
         <groupname>root</groupname>
           <sources>
               <source>
                <destination>my_service.service</destination>
                <location>
                    target/scripts/rpm/etc/systemd/system/my_service.service
                </location>
            </source>
        </sources>
    </mapping>
    <mapping>
        <directory>${rpm.install.directory}</directory>
        <filemode>550</filemode>
        <sources>
            <source>
                <location>${main.basedir}/SERVICE_HOME</location>
            </source>
        </sources>
    </mapping>

    <mapping>
        <directory>${rpm.install.directory}</directory>
        <filemode>777</filemode>
        <sources>
            <source>
                <destination>${artifact-id}.jar</destination>
                <location>${project.build.directory}/MyService.jar</location>
            </source>
        </sources>
    </mapping>


</mappings>
<preinstallScriptlet>
    <scriptFile>${main.basedir}/src/main/scripts/rpm/preInstall.sh</scriptFile>
</preinstallScriptlet>
<postinstallScriptlet>
    <scriptFile>${main.basedir}/src/main/scripts/rpm/postInstall.sh</scriptFile>
</postinstallScriptlet>
<preremoveScriptlet>
    <scriptFile>${main.basedir}/src/main/scripts/rpm/preRemove.sh</scriptFile>
</preremoveScriptlet>
</configuration>
</plugin>

这是 my_service.service 文件

[Unit]
Description=Event Consumer
After=syslog.target

[Service]
Type=simple
Restart=always
RestartSec=5
User=vcs_pbl
ExecStart=/opt/vcs/cegp/dtm/my_service/my_service.jar
WorkingDirectory=/opt/vcs/cegp/dtm/my_service/
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target

正如我所说,这确实会生成一个 RPM(Jenkins、RedHat),我可以在 CentOS 8 上安装它,但它无法启动。我在这里和 Linux 分支上阅读了很多关于此错误的其他答案,但没有一个对我有帮助。

4

0 回答 0