Proc::Daemontools - Perl interface for the functionalities of Daemontools


 use Proc::Daemontools;

 my $svc = new Proc::Daemontools;    # default directories assumed
 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
 # Let´s see what svstat says about it:
 print "The current status of "   . $svc->daemon() .  " " .
       "reported by svstat is: "  . $svc->status() .  "\n";


This module is a Perl interface for Daemontools package. Daemontools was written by Dan Bernstein and is intended to control Unix/Linux daemons.


Proc::Daemontools requires that the Daemontools package be installed on your machine in order to function. It won´t even instantiate its object if it can´t find the Daemontools executables.

It assumes 2 default directories:

        the directory containing svc, svstat, supervise, etc

        the directory monitored by supervise to start/stop 
        the daemons

If you´re not using these default directories you can specify them explicilty within the new() function.

The main goal of Proc::Daemontools is to start/stop the daemons managed by Daemontools, what is done internally with the "svc" command using the options "-u" and "-d".

The other functionalities provided by Daemontools can be implemented later if people require it.



Instantiate a Proc::Daemontools object. Without arguments it assumes its default values for the important directories. Also no default daemon is set.

Returns: object: A Proc::Daemontools object.


    SERVICE_DIR         : path to service dir
    DAEMONTOOLS_DIR     : path to executables dir
    DAEMON              : a the default daemon

To set your directories:

    my $svc = new Proc::Daemontools (
        SERVICE_DIR => "/my_path",
        DAEMONTOOLS_DIR => "/my_path/bin"

To clone an existing object:

    my $svc2 = $svc->new(); # $svc2 has the same atributes of $svc

To set a default daemon:

    my $send = $svc2->new( DAEMON => "qmail-send" );


Set/get the default daemon.

Returns: string: containing the default daemon or undef if none was set.


Starts the default daemon. It not only issues a "svc -u" on the daemon, but it also checks with svstat to see if the daemon really was brought up. So you don´t want to check it again by yourself, ok?

If you pass it a daemon name as an argument it will start the passed daemon instead of the default one.

Returns: boolean: 1 if the daemon is up, 0 otherwise.


Works just like up() but issues a "svc -d" to stop the daemon.

Returns: boolean: 1 if the daemon is down, 0 otherwise.


Prints the output of svstat for the default daemon. It also accepts the name of a daemon as an argument.

Returns: string: the same output of svstat


Returns if the default daemon is up. It also accepts the name of a daemon as an argument.

Returns: boolean: 1 if the daemon is up, 0 otherwise.


Daemontools web site:


Bruno Negrao,


Copyright 2003 by Bruno Negrao

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 262:

Non-ASCII character seen before =encoding in 'didn´t'. Assuming ISO8859-1