Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 976 Categories, Downloaded 29.548.800 Times

Proc::Forking 1.38

  Date Added: August 24, 2010  |  Visits: 865

Proc::Forking

Report Broken Link
Printer Friendly Version


Product Homepage
Download (70 downloads)



Proc::Forking is a Perl module that provides a set of tool to fork and daemonize. SYNOPSIS #!/usr/bin/perl use strict; use Proc::Forking; use Data::Dumper; use Time::HiRes qw(usleep); # to allow micro sleep my $f = Proc::Forking->new(); $SIG{ KILL } = $SIG{ TERM } = $SIG{ INT } = sub { $f->killall_childs;sleep 1; exit }, $f->daemonize( ## uid => 1000, ## gid => 1000, ## home => "/tmp", pid_file => "/tmp/master.pid" ); open( STDOUT, ">>/tmp/master.log" ); my $nbr = 0; my $timemout; while ( 1 ) { if ( $nbr < 20 ) { my $extra = "other parameter"; my ( $status, $pid, $error ) = $f->fork_child( function => &func, name => "new_name.##", args => [ "hello SOMEONE", 3, $extra ], pid_file => "/tmp/fork.##.pid", uid => 1000, gid => 1000, home => "/tmp", max_load => 5, max_mem => 185000000, expiration => 10, # expiration_auto => 1, ); if ( $status == 4 ) # if the load become to high { print "Max load reached, do a little napn"; usleep( 100000 ); next; } elsif ( $status ) # if another kind of error { print "PID=$pidt error=$errorn"; print Dumper( $f->list_names() ); print Dumper( $f->list_pids() ); } } $nbr = $f->pid_nbr; my ( $n, @dp, @dn ) = $f->expirate; if ( $n ) { print Dumper( @dp ); } print "free=<" . scalar( $f->getmemfree ) . ">n"; usleep( 100000 ); # always a good idea to put a small sleep to allow task swapper to gain some free resources } sub func { my $ref = shift; my @args = @$ref; my ( $data, $time_out, $sockC ) = @args; $SIG{ USR1 } = sub { open my $log, ">>/tmp/log.s"; print $log "signal USR1 receivedn"; close $log; }; if ( !$time_out ) { $time_out = 3; } open my $FF, ">>/tmp/loglist"; print $FF $$, " start time =", $^T; close $FF; for ( 1 .. 4 ) { open my $fh, ">>/tmp/log"; if ( defined $fh ) { print $fh "TMOUT = $time_out " . time . " PID=$$ cwd=" . Cwd::cwd() . " name =$0n"; $fh->close; } sleep $time_out + rand( 5 ); } }.

Requirements: No special requirements
Platforms: Linux
Keyword: F- Ff Fork Libraries Perl Module Pid Print Procforking Programming Provides Sig Time To Fork
Users rating: 0/10

License: Freeware Size: 11.26 KB
USER REVIEWS
More Reviews or Write Review


PROC::FORKING RELATED
Libraries  -  Crypt::SSLeay 0.51
Crypt::SSLeay is a Perl module for OpenSSL glue that provides LWP https support. SYNOPSIS lwp-request https://www.nodeworks.com use LWP::UserAgent; my $ua = new LWP::UserAgent; my $req = new HTTP::Request(GET, https://www.nodeworks.com);...
 
Libraries  -  CompBio::DB 0.47
CompBio::DB is a Perl module with methods for accessing data stored according to the CompBio base schema. SYNOPSIS use CompBio::DB; my $cbdb = CompBio::DB->new({host => "foo.bar.edu"); my $AR_defs = $cbdb->get_annotation([keys %seqs]);...
63.49 KB  
Libraries  -  Convert::Wiki 0.05
Convert::Wiki is a Perl module that can convert HTML/POD/txt from/to Wiki code. SYNOPSIS use Convert::Wiki; my $wiki = Convert::Wiki->new(); $wiki->from_txt ( $txt ); die ("Error: " . $wiki->error()) if $wiki->error; print...
19.46 KB  
Libraries  -  Time::Skew 0.1
Time::Skew is a Perl module that computes local clock skew with respect to a remote clock. SYNOPISI use Time::Skew # Init Convex Hull and timing data my $hull=[]; my $result={}; # Iterate data point introduction...
45.06 KB  
Libraries  -  XML::Filter::Dispatcher::AsStructHandler 0.52
XML::Filter::Dispatcher::AsStructHandler Perl module can help you convert SAX stream in to simple, data-oriented structure. SYNOPSIS ## Ordinarily used via the XML::Filter::Dispatchers as_data_struct() ## built-in extension function for XPath...
88.06 KB  
Libraries  -  LRpt::XMLReport 0.16
LRpt::XMLReport is a Perl module for converting outputs generated by LReport tools to XML format. SYNOPSIS lrptxml.pl --selects=selects.txt --keys_file=keys.txt data lrptxml.pl --diffs --selects=selects.txt --keys_file=rkeys.txt diffs.txt...
83.97 KB  
Libraries  -  MathML::Entities 0.13
MathML::Entities is a Perl module that can convert XHTML+MathML Named Entities to Numeric Character References. SYNOPSIS use MathML::Entities; $html = by me; # convert named HTML entities to character references: $numeric =...
17.41 KB  
Libraries  -  Geo::Coordinates::OSGB 1.07
Geo::Coordinates::OSGB is a Perl module that can convert coordinates from Lat/Long to UK Grid. A UK-specific implementation of co-ordinate conversion, following formulae from the Ordnance Survey of Great Britain (hence the name). SYNOPSIS...
4.1 KB  
Libraries  -  Alien Perl module 0.91
Alien Perl module package contains external libraries wrapped up for your viewing pleasure! SYNOPSIS perldoc Alien; Alien is a package that exists just to hold together an idea, the idea of Alien:: packages, so there is no code here, just...
10.24 KB  
Libraries  -  SNMP::Multi 2.1
SNMP::Multi is a Perl module to perform SNMP operations on multiple hosts simultaneously. SYNOPSIS use SNMP::Multi; my $req = SNMP::Multi::VarReq->new ( nonrepeaters => 1, hosts => [ qw/ router1.my.com router2.my.com / ], vars => [ [...
25.6 KB  
NEW DOWNLOADS IN PROGRAMMING, LIBRARIES
Programming  -  FLEX-db Digital Asset Manager 3.0.9
FLEX-db - an enterprise Digital Asset Manager (DAM). It ingests and links metadata with files, creates thumbnails, and processes files using business rules. FLEX-db has a JSP client, Java app server for file input and output and an EJB metadata...
21.57 MB  
Programming  -  Libicom 0.9.0
The libicom library is a character based dynamicly linked library for Linux. It is used to remotely control the Icom IC-R8500 wide band receiver via an RS232 link. All call and return parameters to the control functions are character string based....
20.48 KB  
Programming  -  dotdesktop 0.3
Dotdesktop library provides ability to parse desktop entry file and access the information in a convenient way. Desktop entry file format is defined by freedesktop.org, it is used to describe information about an application such as the name and...
327.68 KB  
Programming  -  Cedalion for Linux 0.2.6
Cedalion is a programming language that allows its users to add new abstractions and define (and use) internal DSLs. Its innovation is in the fact that it uses projectional editing to allow the new abstractions to have no syntactic limitations.
471.04 KB  
Programming  -  libyasl 0.2
Libyasl is a C++ class library to easily realize TCP/UDP/Multicast clientsand servers in IPv4 and IPv6 environments under GNU/Linux systems.
143.36 KB  
Libraries  -  EuGTK 4.8.9
Makes it easy to develop good- looking, fast, cross-platform programs that run on Linux, OS X, and Windows. Euphoria is a very fast interpreted/compiled language with straight-forward syntax. EuGTK allows programming in a clean, object-oriented...
10.68 MB  
Libraries  -  Linux User Group Library Manager 1.0
The LUG Library Manager is a project to help Linux User Groups start their own library. A LUG library is helpful to the community at large because it increases access to information, and gives everyone the opportunity to become more knowledgeable.
5.35 KB  
Libraries  -  Module::MakefilePL::Parse 0.12
Module::MakefilePL::Parse is a Perl module to parse required modules from Makefile.PL. SYNOPSIS use Module::MakefilePL::Parse; open $fh, Makefile.PL; $parser = Module::MakefilePL::Parse->new( join("", ) ); $info = $parser->required;...
8.19 KB  
Libraries  -  sqlpp 0.06
sqlpp Perl package is a SQL preprocessor. sqlpp is a conventional cpp-alike preprocessor taught to understand SQL ( PgSQL, in particular) syntax specificities. In addition to the standard #define/#ifdef/#else/#endif cohort, provides also...
10.24 KB  
Libraries  -  App::SimpleScan::Substitution::Line 2.02
App::SimpleScan::Substitution::Line is a line with optional fixed variable values. SYNOPSIS my $line = App::SimpleScan::Substitution::Line->new(" this "); # Use only this value when substituting " ". $line->fix(substituite =>...
54.27 KB