Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: How to run a 2nd script in background?

by jonnyfolk (Vicar)
on Jan 03, 2008 at 05:44 UTC ( #660126=note: print w/ replies, xml ) Need Help??

in reply to How to run a 2nd script in background?

Here's one way:

#run as child process my $pid; my $script = '/myroot/public_html/cgi-bin/'; if ($pid = fork) { #do something } elsif (defined $pid) { close STDOUT; system $script; } else { die "Major error: $!"; }

Comment on Re: How to run a 2nd script in background?
Download Code
Replies are listed 'Best First'.
Re^2: How to run a 2nd script in background?
by cdarke (Prior) on Jan 03, 2008 at 09:34 UTC
    Using system creates another process, exec is more appropriate here.

    If you are running on Windows you should be aware that fork creates a new thread, not a new process (fork is UNIX architecture). Also (on Windows) to run a script you should prefix the script name with 'perl', since file extension association is done at application, not OS, level. See also Win32::Process and Win32::FetchCommand.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://660126]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2016-02-11 03:34 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (358 votes), past polls