Systemd¶
配置 Java 进程¶
命令方式¶
-
/etc/systemd/system/my-app-maven.service
[Unit] Description=my-app-maven After=network.target After=syslog.target [Service] User=ubuntu Group=ubuntu ExecStart=/opt/env/jdk-17 -jar /opt/module/my-app/maven/my-app-maven.jar StandardOutput=file:/opt/module/my-app-maven/my-app-maven.log StandardError=inherit Type=forking Restart=on-failure [Install] WantedBy=multi-user.target
脚本方式¶
-
/etc/systemd/system/my-app-maven.service
-
/opt/code/my-app-maven/my-app-maven.sh