Skip to content

Instantly share code, notes, and snippets.

@jjn1056
Created October 12, 2018 13:44
Show Gist options
  • Save jjn1056/4ebf5d13b29c4916dbb757e4304b369a to your computer and use it in GitHub Desktop.
Save jjn1056/4ebf5d13b29c4916dbb757e4304b369a to your computer and use it in GitHub Desktop.
jjn@ip-172-31-48-121:~$ cat /usr/local/bin/retreatcenter-fcgi-daemon
#!/var/www/perl5.26.2/bin/perl
use warnings;
use strict;
use lib '/var/www/cpan-lib/lib/perl5';
use Daemon::Control;
my $app_home = '/var/www/src';
my $name = 'retreatcenter';
my $perl = '/var/www/cpan-lib/bin/localenv /var/www/perl5.26.2/bin/perl';
my $program = $app_home . "/script/${name}_fastcgi.pl";
my $pid_file = "/var/run/$name-fcgi.pid";
my $socket = "/tmp/$name-fcgi.socket";
my $workers = 5;
my $logpath = '/var/log/Reg';
my $envvars = 'PATH=/var/www/perl5.26.2/bin DBI_DSN="dbi:mysql:reg2"';
Daemon::Control->new({
name => $name,
lsb_start => '$nginx',
lsb_stop => '$nginx',
lsb_sdesc => $name,
lsb_desc => $name,
path => "/usr/local/bin/$name-fcgi-daemon",
user => 'www-data',
#group => 'www-data',
directory => $app_home,
program => qq[$envvars $perl $program --nproc $workers --listen $socket],
pid_file => $pid_file,
stderr_file => "$logpath/$name-stderr.log",
stdout_file => "$logpath/$name-stdout.log",
fork => 2,
})->run;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment