Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Creating a pidfile for mojolicious is giving an error errors

by newperldeveloper (Sexton)
on Nov 06, 2020 at 00:47 UTC ( [id://11123442]=perlquestion: print w/replies, xml ) Need Help??

newperldeveloper has asked for the wisdom of the Perl Monks concerning the following question:

I am starting my application using a service file. I am trying to create a pid file that mojolicious needs, however what I have tried is not working. Here is my service file.

[Unit] Description=Perl App [Service] Type=forking User=www-data Group=www-data Environment=movielog=/tmp/movie-app/movie.log UMask=007 ExecStart=/webapp/movie-app/local/bin/hypnotoad /webapp/movie-app/scri +pt/movie ExecReload=/webapp/movie-app/local/bin/hypnotoad /webapp/movie-app/scr +ipt/obdaac ExecStop=/webapp/movie-app/local/bin/hypnotoad --stop /webapp/movie-ap +p/script/obdaac TimeoutStopSec=5 PIDFile=/tmp/movie-app/hypnotoad.pid KillMode=mixed [Install] WantedBy=multi-user.target

My hypnotoad file looks like

#!/usr/bin/perl use Mojo::Base -strict; use Mojo::Server::Hypnotoad; use Mojo::Util qw(extract_usage getopt); getopt 'f|foreground' => \$ENV{HYPNOTOAD_FOREGROUND}, 'h|help' => \my $help, 's|stop' => \$ENV{HYPNOTOAD_STOP}, 't|test' => \$ENV{HYPNOTOAD_TEST}; die extract_usage if $help || !(my $app = shift || $ENV{HYPNOTOAD_APP} +); Mojo::Server::Hypnotoad->new->run($app,pid_file => '/tmp/movie-app/hyp +notoad.pid');

Perl keeps trying to create the pid file in the application directory /webapp/movie-app/script/movie and that is causing an error. How do I get hypnotoad to create the pid file in the /tmp/movie-app/hypnotoad.pid location.

Replies are listed 'Best First'.
Re: Creating a pidfile for mojolicious is giving an error errors
by beech (Parson) on Nov 06, 2020 at 03:44 UTC
      Thank you for your help, I added pid_file to the config. I am not to really familiar with mojolicious.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11123442]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-03-29 11:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found