Search code examples
linuxdaemonstartupscript

Long running java process


I have inherited a java system which should be run in the background on a Linux server. The directions call for it to be started java -jar start.jar. This seems a little too fragile for my liking. I'd like it to actually run in the background, ideally starting up automatically at boot time.

What is the best way to achieve this? I've looked into running the system within a screen environment, which works fine, but won't automatically start up when the system reboots.


Solution

  • You can write an init.d script for it! (init.d scripts are started in specified runlevels at startup time)

    Or you can start it in the background with & in the end of the command.

    java -jar start.jar &
    

    What kind of distribution do you use? Debian?

    Have a look at: Creating your own init.d script