On 0, Steve Bertrand <st...@ibctech.ca> wrote: > Michael Pobega wrote: > > 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, > > [...] > > As someone who is staging to become a CPAN author (but not there yet), > I'd recommend that you mail the author with your concerns. If the CPAN > author has honoured their responsibility, then there will be a > responsive email address within the perldoc of the project. >
I'll probably shoot him an e-mail then. I didn't realize the module was at such a low version. > fwiw, to answer your question about not cleanly erasing the pid, I would > first manually ensure the code ( it has comments that contain typos, > does the code? ), then I would focus on file-system permissions that the > user who is executing the code has. ( ensure the code before you allow > it to 'unlink' as a privileged user ). The user definitely has permissions to erase it; at one point I had this: > unlink("/tmp/pid-file") > ? print LOG "Success!" > : print LOG "Failure"; And everytime I ran the program it would print "Success!" to the log file -- yet the file would still be there (and even printing the name of the file proved nothing...the name was definitely correct) > > I'd find something else or re-write it, if I were you... > Extending it is a possibility, but at my current level (midway through reading "Intermediate Perl" it's a bit out of the question. Perhaps in the next month or so I can spruce it up a bit, though. Note: Steve, sorry about replying to you originally. I wasn't thinking when I hit the reply button. -- http://fuzzydev.org/~pobega http://identi.ca/pobega -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/