SPUG: Creating a NON zombie daemon
Thomas Holkenbrink
Thomas_Holkenbrink at emeraldsolutions.com
Mon Apr 17 20:01:27 CDT 2000
I have a Java application that will run like a daemon for a Perl program...
but How do I start the daemon up and Only have one PID associated with it?
I have tried like this but I get two process?
<CODE>
$|=1;
print "Starting Server\n";
use POSIX 'setsid';
chdir '/' or die "Can't chdir to /: $!";
open STDIN, '/dev/null' or die "Can't read /dev/null: $!";
open STDOUT, '>/dev/null' or die "Can't write to /dev/null: $!";
defined(my $pid = fork) or die "Can't fork: $!";
exit if $pid;
setsid or die "Can't start a new session: $!";
open STDERR, '>&STDOUT' or die "Can't dup stdout: $!";
system("java myClass.class");
</CODE>
I would like to be able to something similar in a init script but it wont
work??? any ideas? It seems to function but nothing ever shows up in a "ps
-ef"
Thomas
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
SUBSCRIBE/UNSUBSCRIBE: Replace "action" below by subscribe or unsubscribe
Email to majordomo at pm.org: "action" spug-list your_address
More information about the spug-list
mailing list