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
In reply to Re: background w/out fork?
by sgifford
in thread background w/out fork?
by geektron
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |