JBOSS process quits on shell exit


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting JBOSS process quits on shell exit
# 1  
Old 08-13-2012
JBOSS process quits on shell exit

I decided to add this here as it's related to bash (IMHO) and not necessarily to JBOSS.

The problem started happening a few weeks ago on some of the test systems that I have. When I exit my shell (putty) it hangs forcing me to close the window, which then also stops the JBOSS server. I did not have this problem before, and only a few of the systems have it.

Right now I logon with the following (as the default shell is ksh with "ctrl+d" disabled - set -o ignoreeof):

Code:
bash --rcfile /home/admin/my.profile -i ; exit


Notes:
- I do not have this issue when I logon with ksh.
- I have also tried setting the shell to bash in /etc/passwd, did not work.
- The main JBOSS script is called with "nohup" and "&".
- I have also tried starting the app within "screens", and when I logout it kills both screen and JBOSS processes.


System Info:
Code:
$ uname -a
Linux srs576 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

$ bash -version
GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.

$ ksh --version
  version         sh (AT&T Research) 93t+ 2010-02-02

Any help is appreciated.
Thanks!
# 2  
Old 08-19-2012
The ssh seems to be overly attached to its children, even for no-terminal command execution. Alas, many signals go to all processes of a terminal. I used to keep losing my mwm (X window manager) when I used SIGINT to stop a shell launched program. You might launch it with cron, which by attempting a relaunch every n minutes also gives auto restart, and then it is not entangled in your ssh terminal session. Of course, it has to be sensitive to prior running instances and exit quietly if they are running. The ssh command-only sometimes works OK (no terminal):
Code:
$ ssh localhost -n 'nohup sleep 44 &'
Keyboard-interactive:
PAM authentication
Password: 
Authentication successful.
$ ps -fu $USER | fgrep -v " $$ " | fgrep sleep
UID      PID  PPID C STIME    TTY   TIME COMMAND
myid    6330     1 0 12:57:23 ?     0:00 sleep 44
$


Last edited by DGPickett; 02-22-2013 at 05:51 PM..
# 3  
Old 08-19-2012
When you close your terminal window, anything that still has open file descriptors referring to the terminal is killed. Anything you run will inherit copies of the terminal file descriptors unless they close them themselves or you close them first.

Run them with nohup to prevent them accidentally keeping around such file descriptors.

nohup commandname ...
# 4  
Old 08-22-2012
Thanks for replies everyone. As I had mentioned in my first post, the script itself is run with "nohup" and placed in the background with "&". The script starts a Java process (JBOSS) and other non java services (via other scripts). Only the java process stops when I logout. The other services are still running.
# 5  
Old 08-22-2012
And what happens when you use at (with nohup and &...) to launch your script?
# 6  
Old 08-24-2012
Quote:
Originally Posted by vbe
And what happens when you use at (with nohup and &...) to launch your script?
Do you mean using the "at" command?

Thanks.
# 7  
Old 08-24-2012
The 'at' command is like 'cron' but one-time, with commands on stdin and time on command line. A daemon starts the job, not your session.

I leave daemon processes in all languages running when I log out on all sorts of systems. This seems a bit draconian, almost like a security tool is turned on.

Using a tool like strace/truss/tusc to trace the running daemon into a flat file should tell you what kills it. Be sure to redirect to a file and turn on all the options like follow fork and display thread id. Launch it as:
Code:
nohup strace -fvxo /tmp/<your_app>.tr <your_app> <any_app_options> &

These tools are very UNIX-educational, can be used on code where you have no source, can be used on processes already running.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Linux process exit

friends when I call to a procedure where DBMS_OUTPUT.PUT_LINE bd are having the procedure? (4 Replies)
Discussion started by: tricampeon81
4 Replies

2. Shell Programming and Scripting

Catch exit code of specific background process

Hi all, i hava a specific backgroud process. I have de PID of this process. At some time, the process finish his job, is there any way to catch the exit code? I use "echo $?" normally for commands. Thanks! (2 Replies)
Discussion started by: Xedrox
2 Replies

3. Shell Programming and Scripting

SSH Process monitoring and Exit Status evaluation

Hi All, I have a peculiar requirement as follows, I have a some hosts on which i have to run a script, so i am using the following code piece for i in $HOSTLIST do ssh ${i} "~/task.sh" done Now i want to run this same thing in parallel on all the hosts and then monitor the ssh process... (1 Reply)
Discussion started by: mihirvora16
1 Replies

4. Shell Programming and Scripting

how to exit status of a piped process ???

Hi, I've searched the related threads both in this forum and others in google and found the solution to be working too in most of the places. But somehow it's not working for me. $cmd | tee -a $LOGFILE & pid=$! wait ${pid} ret=$? echo "$ret" I want the exit status of the $cmd.... (8 Replies)
Discussion started by: ashwini.engr07
8 Replies

5. Shell Programming and Scripting

process and exit to new page

File1 --> into shell file for processing --> file2 I have finished the work on my shell processing script, but I need to call this from a form -->cgi-bin, have the form wait/process bar while processing occurs (5-10 seconds) and then have the shell exit gracefully while transferring to the new... (1 Reply)
Discussion started by: dba_frog
1 Replies

6. Shell Programming and Scripting

Track Child process exit

hi, I have a job that spawns multiple child processes in background.. Catch is i want to wait for some jobs to finish before i spawn more background processes. (each job creates a file and deletes at the end of it . so i don't want start new jobs after x amount of disk size is used up) now,... (2 Replies)
Discussion started by: ak_saravanan
2 Replies

7. Programming

Why does my child process not exit?

Im sure it has something to do with the wait() call, but everything ive tried either leaves me with a zombie or with the exec executing indefinitely. switch(pid = fork()) { case -1:perror("fork failed"); exit(1); case 0: if(key == "cd") { execl("/bin/cd", "cd",... (2 Replies)
Discussion started by: p00ndawg
2 Replies

8. Shell Programming and Scripting

way to exit a infinite process

There is a sh file called "agg.sh", this is a kind of negative scenario, this script would fail as expected, but the problem is that after executing the script the following o/p is displayed continuosly without returning the control.We have to press "crtrl+c" to exit the script. ... (3 Replies)
Discussion started by: villain41
3 Replies

9. Shell Programming and Scripting

Shell script process remains after "exit 1"

I have a script that performs an oracle export: <snip> if then exp / full=y file=${exp_file} log=${exp_log} direct=y feedback=1000000 STATISTICS=NONE buffer=20000000 else exp / full=n owner=${schema_name} file=${exp_file} log=${exp_log} direct=y feedback=1000000... (4 Replies)
Discussion started by: Squeakygoose
4 Replies

10. UNIX for Dummies Questions & Answers

exit from telnet kills orbix process

Hi, I'm using a bourne shell to kick off a 3rd Pty app. This app uses Orbix. When I exit from the telnet session which started the app or hit CTRL-C at the command line, the orbix process dies, yet all other process remain. I've tried starting the app as a background process, but it still... (1 Reply)
Discussion started by: edgarm
1 Replies
Login or Register to Ask a Question