Results 1 to 4 of 4

Thread: Run Java program as background process

  1. #1
    Join Date
    Oct 2011
    Beans
    10

    Run Java program as background process

    Hello everyone,

    I've got a pretty special question today. I have a regular Java application that I want to run on a linux-based server. The program is started via command-line-only SSH, which works well.

    The problem is, however, that I need the program to keep running, even if there is no user logged into the system. How would you do that on command line? Any hints? I tried to find answers on Google but it's pretty hard to search for something when you do not really have a significant term for it.


    Thank you,


    Alan

  2. #2
    Join Date
    Nov 2008
    Location
    Sheffield, UK
    Beans
    1,514
    Distro
    Ubuntu

    Re: Run Java program as background process

    there is a few ways

    best is probably set it up as a service and have it run at boot google update-rc.d

    otherwise you could run it with screen or nohup

    Code:
    nohup /path/to/script
    Code:
    screen /plath/to/script

    Code:
    screen -r
    to recall it

  3. #3
    Join Date
    Oct 2011
    Beans
    10

    Re: Run Java program as background process

    @SlugSlug Thank you, I'm going to try the "screen" option, looks promising

  4. #4
    Join Date
    Nov 2008
    Location
    Sheffield, UK
    Beans
    1,514
    Distro
    Ubuntu

    Re: Run Java program as background process

    you could make your script use screen and then run it via init.d so it loads at boot

    thats what I use

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •