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.


In reply to Creating a pidfile for mojolicious is giving an error errors by newperldeveloper

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.