in reply to Re: running a cmd in background and capturing the output
in thread running a cmd in background and capturing the output
Thanks to All for the suggestions, but i tried this way and its working good.
my $myproc = Proc::Simple->new(); $myproc->redirect_output ("/outcome1.txt"); $myproc->start(\&disk_use,"/usr/bin"); my $running = $myproc->poll(); ##to chk if process is still running. my $pid= $myproc->pid; my $bk_id1=$pid; sub disk_use { my $path=shift; my $total_usage=du("$path"); print "total disk uasge is $total_usage\n"; }
Its working:)
|
|---|