запуск java как сервис systemd
Step 1: Create an Application User and group Start by creating a system group for the user. sudo groupadd -r appmgr Next, we create a system user jvmapps with the default group: sudo useradd -r -s /bin/false -g appmgr jvmapps Confirm user created and if with the correct group: $ id jvmapps uid=992(jvmapps) gid=986(appmgr) groups=986(appmgr) Step 2: Create Systemd Service We can now create a systemd service file to manage our application. You need to create this file as root user. sudo vim /etc/systemd/system/myapp.service It will have content like below: [Unit] Description=Manage Java service [Service] WorkingDirectory=/opt/prod ExecStart=/bin/java -Xms128m -Xmx256m -jar myapp.jar User=jvmapps Type=simple Restart=on-failure RestartSec=10 [Install] WantedBy=multi-user.target Set User to the one created earlier, and WorkingDirectory to the directory with a jar file. -Xms128m and -Xmx256m are used to set the minimum and maximum memory that the application can use. When done