I am trying to make a linux executable as a service
I execute my program like this below
java -jar mytestprogram.jar
creates a proc
In Ubuntu you can create the file as explained above with few lines, play around and see if it works for you.
description "My prog"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [!2345]
respawn
respawn limit 10 5
setuid root
setgid shnmon
script
/usr/local/bin/my_script -config.path /etc/myprog/yourconfig.xyz -children false >> /var/log/myprog.log 2>&1
end script
The "-config.path /etc/myprog/yourconfig.xyz" is optional incase you have a config file.
You can just edit the script part and test it and keep others default and edit the rest along the way