develooper Front page | perl.beginners | Postings from October 2009

Daemon::Easy and self-killing

Thread Next
From:
Michael Pobega
Date:
October 14, 2009 18:51
Subject:
Daemon::Easy and self-killing
Message ID:
20091015015102.GA23467@fuzzydev.org
I'm using the Daemon::Easy module to write a basic Perl daemon, but I'm
wondering if there is a way to stop the daemon from within the script (as
opposed to running "./script.pl stop")? Currently I have a subroutine to do
this, but it doesn't seem to cleanly erase the pid file.

> &killMe {
>         unlink("/tmp/.idle_kick-$PID.pid");
>         system("gnome-session-save --force-logout"); # the point of the daemon
>         exit;
> }

And yes, $PID is pointing to the proper file (I've used 'print' to manually get
the value, and it's all right).

I've read all of the documentation for the Daemon::Easy module, but it isn't
exactly what I'd call verbose (on the contrary, it's as simplistic as the
code...)

--
      http://fuzzydev.org/~pobega
        http://identi.ca/pobega

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About