Moving the bot out of the main app.

This commit is contained in:
sergiotarxz 2024-05-06 22:25:13 +02:00
parent 42dc2fb56e
commit 494e89efa1
2 changed files with 13 additions and 5 deletions

View File

@ -60,12 +60,8 @@ sub startup ($self) {
my $pidfile = path('/run/gtsrssapi.pid'); my $pidfile = path('/run/gtsrssapi.pid');
my $gts_bot_pid = path('last_pid_started_gts_bot'); my $gts_bot_pid = path('last_pid_started_gts_bot');
if (-f $pidfile) { if (-f $pidfile) {
my $pidfile_content = $pidfile->slurp;
if (-f $gts_bot_pid && $pidfile_content eq $gts_bot_pid->slurp) {
return; return;
} }
$gts_bot_pid->spew($pidfile_content);
}
$self->start_gts_bot; $self->start_gts_bot;
} }

12
script/gtsrssapi_bot.pl Normal file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env perl
use v5.34.1;
use strict;
use warnings;
use Mojo::File qw(curfile);
use lib curfile->dirname->sibling('lib')->to_string;
use GTSRSSApi;
GTSRSSApi->new->start_gts_bot;
Mojo::IOLoop->start;