[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Starting Daemons
From: |
Adrian Phillips |
Subject: |
Re: Starting Daemons |
Date: |
14 Feb 2002 14:47:53 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 |
>>>>> "Brian" == Brian E Seppanen <seppy@chartermi.net> writes:
Brian> hello: I have a need for using cfengine to restart a daemon
Brian> that will make my life so much easier. Unfortunately when
Brian> cfengine runs the init script as part of the shell
Brian> commmands the script won't let go of the terminal, or
Brian> doesn't properly daemonize. The daemon will not accept
Brian> signals. I'm not sure what exactly the problem is. This
Brian> mean my update stops at the first host and proceeds no
Brian> further.
Which OS is this ? Anyway, I've had the same problem with the NFS
kernel server under Linux. There are many ways of working around this,
a little perl script that runs the daemon is one way. Here is one
daemonize subroutine I found using google. There are probably others.
sub daemonize {
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: $!";
open STDERR, '>>/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: $!";
umask 0;
}
Oh, and this isn't a cfengine problem, its the daemons.
Sincerely,
Adrian Phillips
--
Your mouse has moved.
Windows NT must be restarted for the change to take effect.
Reboot now? [OK]