I followed this guide to setup my Spring Boot app as an init.d service. https://docs.spring.io/spring-boot/docs/current/reference/html/deployment.html#deployment-initd-service My website is working fine, but when I tried to deploy some new changes didn't get updated. This is how I was trying to redeploy:

$ ~/deploy.sh 
rm -rd /var/myapp/target
rm -rd /etc/init.d/myapp
git --git-dir=/var/myapp/.git pull 
sudo systemctl stop myapp
mvn clean package
rm -rd /etc/init.d/myapp
ln -s /var/myapp/target/myapp-0.1.0.jar /etc/init.d/myapp 
systemctl daemon-reload
systemctl start myapp
systemctl status myapp

I checked that my jar had the latest code but it still wouldn't update. I played with it some more and I think I deleted some init.d file and now it's not working at all and gives this error.

$ sudo ln -s /var/myapp/target/myapp-0.1.0.jar /etc/init.d/myapp 
ln: failed to create symbolic link ‘/etc/init.d/myapp’: File exists
$ sudo systemctl start  whatthephil
Failed to start myapp.service: Unit not found.

The Spring guide says creating the link installs the app, but it's not doing it properly. I'm getting no logs in /var/logs/myapp. I used to see logs there. Why is it looking for myapp.service? How does simply creating a link suppose to install an application? Why am I getting Unit not found?

  • unit file is sym linked to jar, which is not init unit file, create service unit file to run the java application Commented Dec 1, 2019 at 7:43

1 Answer 1


It was the nginx cache which needed to get deleted for it to update. rm -rd /var/cache/nginx/cache *

Currently I redeploy my Spring Boot App like this. Something always goes wrong, but it's usually not difficult to see the issue if you check /var/log/myApp.log

service myApp stop
rm -rd /etc/init.d/myApp //careful backup home dir first
rm -rd /var/cache/nginx/cache * 
git --git-dir=/var/myApp/.git pull 
mvn clean package -f /var/myApp/pom.xml
ln -s /var/myApp/target/gs-serving-web-content-0.1.0.jar /etc/init.d/myApp 
service myApp start
service myApp status

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .