Vijay Patel <[EMAIL PROTECTED]> 69 lines of wisdom included: > Hi friends, > I have installed FreeBSD 4.5 on my machine. I am also > having 2 other machines running on linux. > We have developed a code in java which we need to run > in background for 24 hrs. In linux we use... > java Code1 &
This is fine, however this sets the process into the background, however the process still has a parent process. It is natural behaviour, that if a parent process dies, so do the children. In innatural situations, this is how ``zombie'' or ``defunct'' processes appear. In (my favourite shell) zsh, putting the program into the background with ``&|'' can work. e.g. $ java Code1 &| $ jobs $ as opposed to $ java Code1 & $ jobs [1] + running java Test $ In the second situation however, you can ``disown'' the process, which will leave the process in the same state as the first. See zshbuiltins(1). <snip> > bash-2.05a$ ps > PID TT STAT TIME COMMAND > 1087 p0- I 0:00.20 > /usr/local/jdk1.3.1/bin/i386/green_threads/java Code1 > 1105 p0 Ss 0:00.01 -bash (bash) > 1106 p0 R+ 0:00.00 ps Your main problem is that you're trying to run a ``daemon'' process with Java on a FreeBSD system. As you can see, your Java program is attacked to a TTY, which is a bad idea for a ``daemon''. I have come across a wrapper for this, which is located here: http://www2.dystance.net:8080/ping/djinn/ I can't testify how good or bad this is, but it's something to consider at least. > It is showing that code is working right now. But > after 2-3 hours code automatically gets killed. I am > having good provision for keeping all error log iff my > code exists with an error. But here i am sure that it > is getting killed - so i am not getting any error log. If your code is getting killed after a few hours, I would have a look at logging information, and where abouts your code is actually falling over. Also have a look at the ``nohup(1)'' command. This basically means that when the shell sends the JVM a signal to terminate (when you type ``exit'', this is what happens) it ignores it and keeps running. $ nohup Java Code1 & The above is probably your best bet. I am not that familiar with Java debugging utilities for UNIX, especially FreeBSD. However your problem seems to be the method for spawning your program in the background, which I think you need to rethink. -- Philip Reynolds | Technical Director [EMAIL PROTECTED] | RFC Networks Ltd. http://www.rfc-networks.ie | +353 (0)1 8832063 To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message