mschilli / app-daemon Goto Github PK
View Code? Open in Web Editor NEWCPAN Module: Start an Application as a Daemon
Home Page: http://search.cpan.org/dist/App-Daemon/
CPAN Module: Start an Application as a Daemon
Home Page: http://search.cpan.org/dist/App-Daemon/
I was wondering if it is intended behavior that the PID file be removed upon issuing a stop
command. I have this, in a script titled <path>/pl.pl
:
#!/usr/bin/env perl
use warnings;
use v5.12;
use App::Daemon qw( daemonize );
daemonize();
while(1) {
sleep(1);
}
If I start it and run <path>/pl.pl status
I get
Pid file: ./pl.pid
Pid in file: 1080593
Running: yes
Then:
$ <path>/pl.pl stop
$ <path>/pl.pl status
---
Pid file: ./pl.pid
No pidfile found
I ask because the docs seem to suggest the output to status
should be something like
Pid file: ./pl.pid
Pid in file: 1080593
Running: no
Name match: 0
$ cat test.pl
use strict;
use warnings;
use App::Daemon 'daemonize';
daemonize;
while (1) { print "OK\n"; sleep 1; }
$ perl test.pl -X
OK
OK
^C
$ perl test.pl start
$ perl test.pl status
Pid file: ./test.pid
Pid in file: 7806
Running: yes
Erreur de segmentation (core dumped)
$ perl test.pl stop
$ perl -v
This is perl 5, version 12, subversion 2 (v5.12.2) built for x86_64-linux
I have a VPS where I run as root. The script I'm testing is as follows:
#!/usr/bin/env perl
use warnings;
use v5.12;
use App::Daemon qw( daemonize );
$App::Daemon::pidfile = qq|$0.pid|;
use POSIX qw(strftime);
use Time::Interval;
daemonize();
my $now = strftime("%F %T %Z", localtime);
my $diff = getInterval(
$now,
$now,
'small'
);
This dies immediately, because Time::Interval
is prevented from finding Date::Parse
:
# <script> -X
Cannot remove /root/bin/pl.pl.pid at /root/.perlbrew/libs/perl-5.35.0@535/lib/perl5/App/Daemon.pm line 212.
Can't locate Date/Parse.pm: /root/.perlbrew/libs/perl-5.35.0@535/lib/perl5/x86_64-linux/Date/Parse.pm: Permission denied at /root/.perlbrew/libs/perl-5.35.0@535/lib/perl5/Time/Interval.pm line 38.
The file /root/.perlbrew/libs/perl-5.35.0@535/lib/perl5/x86_64-linux/Date/Parse.pm
is definitely there..
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.