in reply to background w/out fork?
It should work when the system boots, but if a user restarts it by hand from their terminal, it will end up as part of their session (and their terminal), and so their shell may kill it when they log out.
Personally, I would run the script under daemontools, but BUU's right that it shouldn't be too hard to wrap your code. You can probably even do it in a seperate file:
(there may be other stuff; see a copy of Stevens)#!/usr/bin/perl use POSIX qw(setsid); fork and exit; fork and exit; chdir("/"); setsid; exec @ARGV or die "Couldn't exec @ARGV: $!\n";
If you call this script daemon.pl, you'd just put in your init.d script:
Update: As dave_the_m points out, the order of redirections is important, and I've fixed it here./usr/local/sbin/daemon.pl \ /usr/local/sbin/relaydelay.pl $CONFIG \ >/var/log/relaydelay.log 2>&1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: background w/out fork?
by geektron (Curate) on Jun 30, 2004 at 21:37 UTC | |
by sgifford (Prior) on Jun 30, 2004 at 21:45 UTC | |
by geektron (Curate) on Jun 30, 2004 at 21:48 UTC |