SPUG: perl question...
Matt Tucker
tuck at whistlingfish.net
Fri Jan 12 13:40:32 CST 2001
-- Bhargava Vadapalli <Bhargava at drugstore.com> spake thusly:
> I was wondering if anyone can help me run a perl program as a
> background process.
>
> I am being lazy and asking you all instead of finding out for
> myself...but hey why re-invent the wheel !!
$ perl <scriptname> &
or even:
$ /path/to/script &
Or did you want it to background itself?
#!/usr/bin/perl
use warnings;
use strict;
exit &main();
sub main {
my $pid = fork;
defined $pid or die "Can't fork";
return 0 if $pid;
# You could close stdout/stderr here if you wanted, and
# send all output to syslog or something
# <Do whatever needs doing>
return 0;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://mail.pm.org/archives/spug-list/attachments/20010112/743b8bf0/attachment.bin
More information about the spug-list
mailing list