Git Product home page Git Product logo

app-daemon's People

Contributors

fleetfootmike avatar mschilli avatar mstratman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

app-daemon's Issues

removes PID file?

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

Segmentation fault on status

$ 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

prevents other packages from accessing libraries they require when run by root user

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..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.