0
0

Libertyでsystemdの設定してみました

Last updated at Posted at 2024-09-22

SystemdにLibertyをサービス登録して起動を実行 → 失敗

あれれうまくいかない。。。

以下の対応が必要でした。

bashでの起動が必要。まぁjavaを起動するから当たり前と言えば当たり前ですが

bash -l -cを付けている説明

-lはログインスクリプトのような動作

manからの引用

言いたいこと:ログインするときと同じだよってこと
※読み込ませたい変数がある場合は、こっちがおススメ。

bash が対話的なログインシェルとして起動されるか、 
--login オプション付きの非対話的シェルとして起動されると、
/etc/profile  ファイルが存在すれば、
bashはまずここからコマンドを読み込んで実行します。
このファイルを読んだ後、   bash   は  ~/.bash_profile,  ~/.bash_login,  ~/.profile  をこの順番で探します。
bashは、この中で最初に見つかり、かつ読み込みが可能であるファイルからコマンドを読み込んで実行します。--noprofileオプションを使ってシェルを起動すれば、 
この動作を行わないようにできます。

-cはbashとして実行

[Unit]
Description=WebSphere Liberty Application Server
After=network-online.target
Wants=network-online.target

[Service]
Type=forking
PIDFile=/opt/wlp/usr/servers/.pid/%I.pid
ExecStart=/usr/bin/bash -l -c "/opt/wlp/bin/server start %I"
ExecStop=/usr/bin/bash -l -c "/opt/wlp/bin/server stop %I"
# Allow a minute for ExecStop before systemd sends SIGTERM
TimeoutStopSec=60
# JVM returns 143 after being killed with SIGTERM
SuccessExitStatus=143

[Install]
WantedBy=default.target
[root@mq1 system]#

公式サイトに書いておいてよ。

※自分の理解が低いだけかも。。。。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0