Discussion Locked

Background Process closes on logout

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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

5 replies

by edward

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

by shanghai sam

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

by skizz

Another way of doing it is with "at"

eg.
# at now
StartServletExec
^D
#

by shanghai sam

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

This discussion is closed to new replies.