2
votes

I followed the spring boot reference guide for installation of service as init.d service but it does not seem to work. Any idea what may be going wrong here?

Ubuntu host on AWS

$ cat /etc/issue
Ubuntu 14.04.3 LTS \n \l

Installed the application as init.d service using symlink as per reference document

$ sudo ln -s /opt/services/account-history-service/account-history-service-0.0.1-217782-SNAPSHOT.jar /etc/init.d/account-history-service

$ sudo /etc/init.d/account-history-service status
sudo: /etc/init.d/account-history-service: command not found

$ sudo chmod +x /etc/init.d/account-history-service

Tried start but it failed with below error

$ sudo /etc/init.d/account-history-service start
/etc/init.d/account-history-service: 1: /etc/init.d/account-history-service: Syntax error: "(" unexpected

Any idea what may be wrong? Is this version of ubuntu not supported?

1
Have you updated your build script to produce a fully executable jar?Andy Wilkinson
did you try to run the executable jar directly before using it as a service by calling: $/opt/services/account-history-service/account-history-service-0.0.1-217782-SNAPSHOT.jarGuy Bouallet
It seems like it was totally unrelated issue. I was trying with snapshot version and somehow nexus proxy was serving old version of artifact. Thanks for all the responses.itwarilal
I can't get this to work in 1.3.0.RELEASE. The repackaging happens, but I get exec format error.Distortum

1 Answers

0
votes

This works for me. First make sure that you have configured maven for fully executable jar in POM.xml. Then rebuild the application and create the symlink again.

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <executable>true</executable>
    </configuration>
</plugin>