web-dev-qa-db-ja.com

CentOS 7(systemd)上のGlassFish-「asadminrestart-domain」が期待どおりに機能しない

CentOS7のGlassFish4には次のsystemdスクリプトを使用します。

[Unit]
Description = GlassFish Server v4.1
After = syslog.target network.target

[Service]
User=glassfish
ExecStart = /usr/bin/Java -jar /home/glassfish/glassfish4/glassfish/lib/client/appserver-cli.jar start-domain
ExecStop = /usr/bin/Java -jar /home/glassfish/glassfish4/glassfish/lib/client/appserver-cli.jar stop-domain
ExecReload = /usr/bin/Java -jar /home/glassfish/glassfish4/glassfish/lib/client/appserver-cli.jar restart-domain
Type = forking

[Install]
WantedBy = multi-user.target

問題 Webアプリケーション自体またはNetBeansIDE、またはGlassFishWeb管理ページを介してコマンド「asadminrestart-domain」を実行すると=>サーバー=>再起動-GlassFishのすべてのプロセスが停止したため、誰も停止しませんでしたGlassFishを再起動できます。

オリジナルのGlassFishスクリプト(SysV)を使用するCentOS 6では、すべてが正常に機能します。

それを修正する方法はありますか?

編集1:

1)再起動に失敗した後のプロセスのステータス

# systemctl status glassfish
● glassfish.service - GlassFish Server v4.1.2
    Loaded: loaded (/etc/systemd/system/glassfish.service; enabled; vendor preset: disabled)
    Active: inactive (dead) since Thu 2017-05-25 02:25:46 CDT; 11s ago
  Process: 13465 ExecStop=/usr/bin/Java -jar /local/glassfish4/glassfish/lib/client/appserver-cli.jar stop-domain (code=exited, status=0/SUCCESS)
  Process: 13338 ExecStart=/usr/bin/Java -jar /local/glassfish4/glassfish/lib/client/appserver-cli.jar start-domain (code=exited, status=0/SUCCESS)
 Main PID: 13351 (code=exited, status=0/SUCCESS)

May 25 02:25:24 dev3.local systemd[1]: Starting GlassFish Server v4.1.2...
May 25 02:25:28 dev3.local Java[13338]: Waiting for domain1 to start ....
May 25 02:25:28 dev3.local Java[13338]: Successfully started the domain : domain1
May 25 02:25:28 dev3.local Java[13338]: domain  Location: /local/glassfish4/glassfish/domains/domain1
May 25 02:25:28 dev3.local Java[13338]: Log File: /local/glassfish4/glassfish/domains/domain1/logs/server.log
May 25 02:25:28 dev3.local Java[13338]: Admin Port: 4848
May 25 02:25:28 dev3.local Java[13338]: Command start-domain executed successfully.
May 25 02:25:29 dev3.local systemd[1]: Started GlassFish Server v4.1.2.
May 25 02:25:46 dev3.local Java[13465]: CLI306: Warning - The server located at /local/glassfish4/glassfish/domains/domain1 is not running.
May 25 02:25:46 dev3.local Java[13465]: Command stop-domain executed successfully.

2)再起動に失敗した後のプロセスのステータス(systemd構成ファイルにRestartForceExitStatus = SIGUSR1がある)

#systemctl status glassfish
● glassfish.service - GlassFish Server v4.1.2
    Loaded: loaded (/etc/systemd/system/glassfish.service; enabled; vendor preset: disabled)
    Active: failed (Result: exit-code) since Thu 2017-05-25 02:15:16 CDT; 15s ago
  Process: 12994 ExecStop=/usr/bin/Java -jar /local/glassfish4/glassfish/lib/client/appserver-cli.jar stop-domain (code=exited, status=0/SUCCESS)
  Process: 12859 ExecStart=/usr/bin/Java -jar /local/glassfish4/glassfish/lib/client/appserver-cli.jar start-domain (code=exited, status=0/SUCCESS)
 Main PID: 12872 (code=exited, status=12)

May 25 02:13:36 dev3.local Java[12859]: domain  Location: /local/glassfish4/glassfish/domains/domain1
May 25 02:13:36 dev3.local Java[12859]: Log File: /local/glassfish4/glassfish/domains/domain1/logs/server.log
May 25 02:13:36 dev3.local Java[12859]: Admin Port: 4848
May 25 02:13:36 dev3.local Java[12859]: Command start-domain executed successfully.
May 25 02:13:37 dev3.local systemd[1]: Started GlassFish Server v4.1.2.
May 25 02:15:15 dev3.local systemd[1]: glassfish.service: main process exited, code=exited, status=12/n/a
May 25 02:15:16 dev3.local Java[12994]: CLI306: Warning - The server located at /local/glassfish4/glassfish/domains/domain1 is not running.
May 25 02:15:16 dev3.local Java[12994]: Command stop-domain executed successfully.
May 25 02:15:16 dev3.local systemd[1]: Unit glassfish.service entered failed state.
May 25 02:15:16 dev3.local systemd[1]: glassfish.service failed.
1
Andrew-Gr

セクション[サービス]に追加する必要がありますRestart=on-failure

1
enchaslo

GlassfishプロセスにSIGUSR1シグナルを送信し、デフォルトで終了するのではないかと思います。 RestartForceExitStatus=SIGUSR1をサービスに追加してみて、それが役立つかどうかを確認します。

0
Tollef Fog Heen