發表文章

目前顯示的是有「systemd」標籤的文章

IT|軟體|維運管理|作業系統|Linux|Java 應用 Ubuntu 平台以 Systemd 服務方式運行

Linux Ubuntu 版本 18.04 sudo nano /etc/systemd/system/test.service [Unit] Description=Manage Java service [Service] User=lilee WorkingDirectory=/home/lilee/Signal/project ExecStart=/usr/bin/java -jar aaron-ui-1.0-SNAPSHOT.jar  --spring.profiles.active=prod & Type=simple Restart=on-failure RestartSec=10 [Install] WantedBy=multi-user.target 參數說明 ======= WorkingDirectory 工作目錄 /home/lilee/Signal/project ExecStart 執行 jar 及指定 /usr/bin/java -jar aaron-ui-1.0-SNAPSHOT.jar  --spring.profiles.active=prod & sudo systemctl daemon-reload 啟動服務 sudo systemctl start test.service 停止服務 sudo systemctl stop test.service 查看服務狀態 sudo systemctl status test 開機自動啟動 sudo systemctl enable test.service  參考 [1].  https://computingforgeeks.com/how-to-run-java-jar-application-with-systemd-on-linux/ 這封郵件來自 Evernote。Evernote 是您專屬的工作空間, 免費下載 Evernote

IT|作業系統|Linux|Ubuntu rc.local systemd 開機自動執行應用程式

作業系統版本 Ubuntu 18.04  使用  systemd  設置開機啓動: systemd  默認讀取  /etc/systemd/system  下的配置文件 該目錄下的文件會鏈接  /lib/systemd/system/  下的文件。 一般系統安裝完  /lib/systemd/system/  下會有  rc-local.service 文件,即需要的配置文件。 ln -fs /lib/systemd/system/rc-local.service /etc/systemd/system/rc-local.service cd /etc/systemd/system/ cat rc-local.service rc-local.service内容 # SPDX-License-Identifier: LGPL-2.1+ # # This fileispart ofsystemd. # # systemd isfree software; you can redistribute it and/ormodify it # under the terms ofthe GNU Lesser General PublicLicense aspublishedby # the Free Software Foundation; either version 2.1ofthe License, or # (at your option) any later version. # This unitgets pulled automatically into multi-user.target by # systemd-rc-local-generator if/etc/rc.localisexecutable. [Unit] Description=/etc/rc.localCompatibility Documentation=man:systemd-rc-local-generator(8) ConditionFileIsExecutabl...