Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: background system() and stillalive() sub

by jbt (Chaplain)
on Aug 02, 2009 at 03:41 UTC ( [id://785179]=note: print w/replies, xml ) Need Help??


in reply to background system() and stillalive() sub

Have you searched CPAN for a module?

IPC::Run
Proc::Background
...

  • Comment on Re: background system() and stillalive() sub

Replies are listed 'Best First'.
Re^2: background system() and stillalive() sub
by iaw4 (Monk) on Aug 03, 2009 at 18:39 UTC
    Proc::Background was exactly the wrapper I needed. Mille grazie.
    #!/usr/bin/perl -w
    use strict;
    use Proc::Background;
    
    my $pid1 = Proc::Background->new("cd /tmp ; pwd > testplpwd ; sleep 100");
    
    for (my $i=0; ; ++$i) {
        print STDERR "$i: Your pid $pid1 is ".($pid1->alive())."\n";
        ($pid1->alive()) or last;
        sleep(1);
    }
    
    /iaw

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-20 01:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found