mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-14 21:56:41 +01:00
79a8f439b6
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
29 lines
569 B
Perl
29 lines
569 B
Perl
#!/usr/bin/perl
|
|
|
|
use strict;
|
|
use warnings FATAL => qw( all );
|
|
|
|
use IO::Socket::UNIX;
|
|
|
|
my $bin_path = '/usr/sbin/fcgiwrap';
|
|
my $socket_path = $ARGV[0] || '/tmp/cgi.sock';
|
|
my $num_children = $ARGV[1] || 1;
|
|
|
|
close STDIN;
|
|
|
|
unlink $socket_path;
|
|
my $socket = IO::Socket::UNIX->new(
|
|
Local => $socket_path,
|
|
Listen => 100,
|
|
);
|
|
|
|
die "Cannot create socket at $socket_path: $!\n" unless $socket;
|
|
|
|
for (1 .. $num_children) {
|
|
my $pid = fork;
|
|
die "Cannot fork: $!" unless defined $pid;
|
|
next if $pid;
|
|
|
|
exec $bin_path;
|
|
die "Failed to exec $bin_path: $!\n";
|
|
}
|