General discussion

  • Creator
    Topic
  • #2128774

    Background Process closes on logout

    Locked

    by peter marshall ·

    We use a servlet engine on a Solaris box for our applications (ServletExec 3.1 from New Atlanta)
    It is started by the application user from the command line
    $ ./StartServletExec &
    When that user logs out of the shell either by using exit or ^D amessage is displayed stating that there are background jobs running. We then execute either exit or ^D again to exit the shell.
    As another user we execute ps -ef |grep java and we can see that the background process is nolonger running.
    If ServeletExec is executed by root then the process will continue on logout.
    I am after ways to ensure that the background process continues when the user is logged out when it is not started by root.

    Thanks
    Peter

All Comments

  • Author
    Replies
    • #3422477

      Background Process closes on logout

      by edward ·

      In reply to Background Process closes on logout

      Hello,
      I believe that command “nohup” will help you to do the job. You just run “/usr/bin/nohup & ” and this makes your command running immune to hangups. It does so arranging for the SIGHUP signal to be ignoring by the process, so when user exits the shell, this signal won’t interrupt your process running. Note though that SIGTERM signal will terminate the process regardless of running it with nohup.
      Hope that helps

      • #3446618

        Background Process closes on logout

        by shanghai sam ·

        In reply to Background Process closes on logout

        Thanks to both of you for your input. Both solutions worked.

        I have adopted the answer given by Edward as it is easier to put in a script that the developers are able to run. at jobs might be just a bit beyond them.

        Thanks again for the assistance

        Peter

    • #3423185

      Background Process closes on logout

      by skizz ·

      In reply to Background Process closes on logout

      Another way of doing it is with “at”

      eg.
      # at now
      StartServletExec
      ^D
      #

      • #3446619

        Background Process closes on logout

        by shanghai sam ·

        In reply to Background Process closes on logout

        Thanks to both of you for your input. Both solutions worked.

        I have adopted the answer given by Edward as it is easier to put in a script that the developers are able to run. at jobs might be just a bit beyond them.

        Thanks again for the assistance

        Peter

    • #3446617

      Background Process closes on logout

      by peter marshall ·

      In reply to Background Process closes on logout

      This question was closed by the author

Viewing 2 reply threads