Runnig Spring Boot Application on Arch Linux

We need to create new "simple" systemd service. It is just a single text file.
# pwd
/etc/systemd/system

Create file: whatever_you_want.service with similar content
[Unit]
Description=webserver Daemon

[Service]
ExecStart=/opt/jdk1.8.0_101/bin/java -Djava.security.egd=file:/dev/./urandom -jar /root/spring-boot-1.0-BETA.jar
User=user

[Install]
WantedBy=multi-user.target

That's really it!. Now you can use following commands to control newly created service.

To start the service
# systemctl start whatever_you_want.service

To auto start the service
# systemctl enable whatever_you_want.service

[root@vps]# systemctl enable flex-demo
Created symlink /etc/systemd/system/multi-user.target.wants/whatever_you_want.service → /etc/systemd/system/whatever_you_want.service.

To stop autostart
# systemctl disable whatever_you_want.service

To stop the service
# systemctl stop whatever_you_want.service

To restart the service
# systemctl restart whatever_you_want.service

Comments

Popular posts from this blog

Hardening OpenWRT - adding non-root user account

Dropbear SSH keys and autossh on OpenWRT

SSH Tunel with OpenWRT