My new module Proc::Daemontools

Bruno Negrão <[email protected]>
Newsgroups gmane.comp.djb.syslog
Message-ID <[email protected]>
Hi all,

I wrote a module called Proc::Daemontools and I published it on CPAN. You
can find it on:
http://theoryx5.uwinnipeg.ca/mod_perl/cpan-search?new=Search;join=and;age=;arrange=file;case=clike;site=ftp.funet.fi;stem=no;download=auto;modinfo=16614

Bellow goes its synopsis:
-------------------------------------------------
 use Proc::Daemontools; my $svc = new Proc::Daemontools;    # default
directories assumed

     or

 my $svc = new Proc::Daemontools (
             DAEMONTOOLS_DIR => "/some-non-default-dir",
             SERVICE_DIR    => "/some-non-default-dir",
             DAEMON  => "daemon-name"    # optional: a default daemon
           );

 if ( $svc->is_up() ) {
     print $svc->daemon(), " IS UP!\n";
 }

 my $daemon="qmail-send";
 # We want to stop $daemon instead of the default daemon
 if ( $svc->is_up($daemon) ) {
     if ( $svc->down($daemon) ) {
         print "OK, $daemon stopped. \n";
     } else {
         print "Ops, $daemon didn´t stop yet. Maybe it is waiting" .
               " for some child to exit. Perhaps you want to kill" .
               " that child by yourself... \n";
     }
 }

 # Now we want it to start
 if ( $svc->up($daemon) ) {
     print "OK, $daemon started. \n".
 }

 # Let´s set the default daemon to be qmail-smtpd
 $svc->daemon("qmail-smtpd");

 # Let´s see what svstat says about it:
 print "The current status of "   . $svc->daemon() .  " " .
       "reported by svstat is: "  . $svc->status() .  "\n";

-----------------------------------------------------------
It´s not full-featured yet. Any feedback will be appreciated.

Bruno Negrao.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.