I want to start a jar file (Spring Boot app), with additional parameters.
It start normally when I start by shell command:
java -jar spring.boot.jar --parameter01="My Parameter Value 01" --parameter02="My Parameter Value 02"
Now, I want to pass all parameters into a bash shell (to start it as a service within /etc/init.d)
java -jar spring.boot.jar $1
($1 is equals value above >> --parameter01="My Parameter Value 01" --parameter02="My Parameter Value 02")
Then Spring app doesn't recognize the value "My Parameter Value 01", but only "My". What should I do ? I tried to escape the space character and quote character, but nothing work.
I think you could try if your system supports systemd:
Create a service file with a name you consider is appropriate for you in the /etc/systemd/system/ directory:
Next you have to reload systemd:
Next you can start it:
Get status:
Stop it:
Or add it to autostart with system booting:
To troubleshot you could run the next in parallel terminal window to see the realtime changes:
A simple script to call your
java -jar spring.boot.jar
with a single parameter, let's call it /etc/init.d/run-spring-boot, be sure tochmod +x /etc/init.d/run-spring-boot
before executing it:Invoke the script with a single input parameter of the entire string quoted and with escaped inner quotation marks: