On Mon, 29 Sep 2003 23:51:22 +0200, Grischa Schuering <> wrote:
> Hello,
>
> I have a perl daemon running using the start-stop-daemon in background mode.
> Now I would like to get the mnessages, that were originally send on STDIN,
> STDOUT, STDERR to a file.
>
> Using start-stop-daemon --exec $DAEMON --background >$2 file.log is not
> working. No wonder, sonce a backround task should not send any information
> to STDIN and so on.
>
> What is the correct command to get the mesages to file or syslog
> (whatever)???
Look for SyS::Syslog module.
Working example:
#!/usr/bin/perl -w
# Name of this script
if ($0 =~ m|/([^/]+)$|) { $id = $1; } else { $id = $0; }
use Sys::Syslog qw(

EFAULT setlogsock);
setlogsock 'unix' || die "Can't setlogsock";
sub mylog {
my $msg = shift;
chomp $msg; # if needed
syslog('info',"$id\[$$]:$msg"); closelog();
}
mylog("I'm running");
The script was called 'logme', result in syslog:
Sep 29 18:48:27 efflandt logme[31707]: I'm running
--
David Efflandt - All spam ignored
http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/