nohup hangs up process / remote logins tied to the first one

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.

[INDENT][LIST=1]
[]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.
[/LIST][/INDENT]

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.

[QUOTE=eunic;5147]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.

[COLOR="#FF0000"]This system is SLES 11[/COLOR]
[COLOR="#FF0000"]
Problem :[/COLOR]

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.

[INDENT][LIST=1]
[]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.
[/LIST][/INDENT]

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.[/QUOTE]

This box is [COLOR="#FF0000"]SLES 11[/COLOR] 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

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)

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.

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.