Make fully executable applications for Unix systems
A fully executable jar can be executed like any other executable binary or it can be registered with init.d or systemd
Gradle configuration:
bootJar { launchScript() }
Installation as a systemd Service
create a script named myapp.service
and place it in /etc/systemd/system
directory
[Unit] Description=myapp After=syslog.target [Service] User=myapp ExecStart=/var/myapp/myapp.jar SuccessExitStatus=143 [Install] WantedBy=multi-user.target
Remember to change the Description
, User
, and ExecStart
fields for your application.
To flag the application to start automatically on system boot, use the following command:
systemctl enable myapp.service
References
https://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-managing_services_with_systemd-unit_files
https://tecadmin.net/setup-autorun-python-script-using-systemd/
https://www.raspberrypi-spy.co.uk/2015/10/how-to-autorun-a-python-script-on-boot-using-systemd/