in reply to Forking not working when perl runs in Docker
Docker file:
FROM perl:5.24 MAINTAINER Neil Watson <neil@w**.ca> LABEL site="cfbot" LABEL version="1.0" RUN cpanm Config::YAML JSON Bot::BasicBot Cache::FastMmap XML::Feed \ Mojo::UserAgent Mojo::DOM Net::SSLeay # Force this install because of bug: # https://rt.cpan.org/Public/Bug/Display.html?id=118548 RUN cpanm --force POE::Component::SSLify COPY . /var/lib/cfbot # TODO have bot pull this down and keep it up to date RUN cd /usr/src/ \ && git clone https://github.com/cfengine/documentation.git \ && ln -fs /usr/src/documentation /var/lib/cfbot/documentation WORKDIR /var/lib/cfbot CMD [ "perl", "cfbot.pm", "--debug" ]
Tick subroutine:
sub tick { my $self=shift; my %wake_interval; $wake_interval{seconds} = $config->{wake_interval} * 60; my $now = Time::Piece->localtime(); return 60 if ( $now < $hush ); my @events = ( { name => \&cfbot::atom_feed, arg => [{ 'feed' => "$config->{bug_feed}" }] }, { name => \&cfbot::git_feed, arg => [{ 'feed' => $config->{git_feed}, 'owner' => 'cfengine', 'repo' => 'core', }] }, { name => \&cfbot::git_feed, arg => [{ 'feed' => $config->{git_feed}, 'owner' => 'cfengine', 'repo' => 'masterfiles', }] }, { name => \&cfbot::git_feed, arg => [{ 'feed' => $config->{git_feed}, 'owner' => 'neilhwatson', 'repo' => 'evolve_cfengine_freelib', }] }, { name => \&cfbot::git_feed, arg => [{ 'feed' => $config->{git_feed}, 'owner' => 'neilhwatson', 'repo' => 'delta_reporting', }] }, { name => \&cfbot::git_feed, arg => [{ 'feed' => $config->{git_feed}, 'owner' => 'neilhwatson', 'repo' => 'vim_cf3', }] }, { name => \&cfbot::git_feed, arg => [{ 'feed' => $config->{git_feed}, 'owner' => 'neilhwatson', 'repo' => 'cfbot', }] }, { name => \&cfbot::say_words_of_wisdom, arg => [ '' ], }, { name => \&cfbot::index_cfe_functions, arg => [ '' ], }, ); for my $e ( @events ) { $self->forkit({ run => $e->{name}, arguments => $e->{arg}, channel => $config->{irc}{channels}[0], handler => '_fork_notice', }); } return $wake_interval{seconds}; }
|
|---|