PDA

View Full Version : nohup hangs up process / remote logins tied to the first one



eunic
17-Jun-2012, 02:30
I have an interesting problem that I think may be a configuration issue but there are a couple of symptoms that I will list here.

Background : I have several SLES 10 boxes in this environment but I am only seeing the below described problem on a few.

Problem :

I have an application user account that needs to run a script that kicks off 3-3 processes and these processes need to continue to run.
The user has a script that uses nohup embedded in the script to kick off the the processes. The script properly redirects stdout>std in and backgrounds the script.
The script is kicked off with sudo as the processes need to run as root.

Note: I modified a copy of the script with setuid so that it would run as root but that does not work as the processes take on the name of the user acct.



If I login to the account again with a ssh (putty) session to monitor the process table, and log out of the first window, the processes are killed and the second window is also logged out.

If I kill the window, I get the same result.



Now as root, I created a test script and logged in multiple times to see if I would get the same results and I do not. nohup works perfectly and killing any of my login sessions does not affect the others.

Root is using bash and the user account is using csh but changin the user account to use bash does not stop the behaviour and only trashed the application environment variables.

I am not quite sure where to look to fix the problem.

I suspect that the problem is in the fact that all of the remote login session to that machine under that user seem to be tied together as a single pty but when I do a "w" each login has a different TTY assignment {pts/0, pts1 etc}.

Any thoughts or suggestions would be greatly appreciated.

eunic
17-Jun-2012, 13:11
I have an interesting problem that I think may be a configuration issue but there are a couple of symptoms that I will list here.

Background : I have several SLES 10 and 11 boxes in this environment but I am only seeing the below described problem on a few of the SLES 11 boxes but not all.

This system is SLES 11

Problem :

I have an application user account that needs to run a script that kicks off 3-3 processes and these processes need to continue to run.
The user has a script that uses nohup embedded in the script to kick off the the processes. The script properly redirects stdout>std in and backgrounds the script.
The script is kicked off with sudo as the processes need to run as root.

Note: I modified a copy of the script with setuid so that it would run as root but that does not work as the processes take on the name of the user acct.



If I login to the account again with a ssh (putty) session to monitor the process table, and log out of the first window, the processes are killed and the second window is also logged out.

If I kill the window, I get the same result.



Now as root, I created a test script and logged in multiple times to see if I would get the same results and I do not. nohup works perfectly and killing any of my login sessions does not affect the others.

Root is using bash and the user account is using csh but changin the user account to use bash does not stop the behaviour and only trashed the application environment variables.

I am not quite sure where to look to fix the problem.

I suspect that the problem is in the fact that all of the remote login session to that machine under that user seem to be tied together as a single pty but when I do a "w" each login has a different TTY assignment {pts/0, pts1 etc}.

Any thoughts or suggestions would be greatly appreciated.

This box is SLES 11 -> I added some info in the original quoted text

malcolmlewis
17-Jun-2012, 13:49
eunic;5147 Wrote:
> I have an interesting problem that I think may be a configuration
> issue but there are a couple of symptoms that I will list here.
>
> Background : I have several SLES 10 and 11 boxes in this environment
> but I am only seeing the below described problem on a few of the SLES
> 11 boxes but not all.
>
> THIS SYSTEM IS SLES 11
> *
> Problem :*
>
> I have an application user account that needs to run a script that
> kicks off 3-3 processes and these processes need to continue to run.
> The user has a script that uses nohup embedded in the script to kick
> off the the processes. The script properly redirects stdout>std in
> and backgrounds the script.
> The script is kicked off with sudo as the processes need to run as
> root.
>
> *Note:* -I modified a copy of the script with setuid so that it would
> run as root but that does not work as the processes take on the name
> of the user acct.-
>
>
> >
- If I login to the account again with a ssh (putty) session to
> monitor the process table, and log out of the first window, the
> processes are killed and the second window is also logged out.
-
- If I kill the window, I get the same result.
> > >
>
>
> Now as root, I created a test script and logged in multiple times to
> see if I would get the same results and I do not. nohup works
> perfectly and killing any of my login sessions does not affect the
> others.
>
> Root is using bash and the user account is using csh but changin the
> user account to use bash does not stop the behaviour and only trashed
> the application environment variables.
>
> I am not quite sure where to look to fix the problem.
>
> I suspect that the problem is in the fact that all of the remote
> login session to that machine under that user seem to be tied together
> as a single pty but when I do a "w" each login has a different TTY
> assignment {pts/0, pts1 etc}.
>
> Any thoughts or suggestions would be greatly appreciated.

This box is *SLES 11* ->- I added some info in the original quoted
text-



Hi
I would suggest looking at startproc really you want to daemonize the
process. Have a look at the /etc/init.d/skeleton file for some tips.

--
Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.1 (x86_64) Kernel 3.1.10-1.9-desktop
up 20:21, 4 users, load average: 0.00, 0.02, 0.05
CPU Intel i5 CPU M520@2.40GHz | Intel Arrandale GPU

eunic
17-Jun-2012, 17:09
I will take a look at that but I don't think that is the route that I want to take because we have several servers in the environment (both 10 and 11) where the process is working perfectly.

I think there is some configuration setting on this particular server that needs to be changed. If I kick the process of, it will detach and run until I close any of the independent ssh/putty sessions to the same box under the same user.

Even if all of the remote login shells were tied to one pty, nohup should separate the process from the shell and continue to run.

Nohup getting a signal 15 and the cascaded closure of the other shells is a symptomof something that I think is configurable.

Eunix (c)

eunic
18-Jun-2012, 05:15
Note : Additional research yielded brings me to a better descripton of the problem.

The user account behaves as if SSH Control Master has been turned on but it not in the user account or in the system config.
I am not familiar with LDAP or PAM and I am wondering if there is a similar setting in either that could be misconfigured for this account that is causing the problem.

enovaklbank
22-Jun-2012, 13:02
Check your shell settings with shopt.
huponexit off
This also has to do with the way the shell is invoked (see man bash -> invocations)

But malcolmlewis is right, you should use startproc/sysvinit to accomplish this. The fact that it works on some boxes does not legitimate the method.

BTW using 'screen' would be the easiest option.