ControlFreak

 view release on metacpan or  search on metacpan

lib/ControlFreak/Tutorial.pod  view on Meta::CPAN

=pod

=head1 NAME

ControlFreak Tutorial

=head1 INSTALLATION

ControlFreak should work on all unixes and maybe more, only Mac OS X and Linux
have been tested.

=head2 Requirements

Notable ControlFreak requirements are:

=over 4

=item * AnyEvent

(recent versions 5.202+)

=item * EV (libev interface)

Though it's not stricly necessary, this is really recommended, ControlFreak
hasn't been tested thoroughly with other Event loops.

=item * Log4perl

This is the logging backend of ControlFreak.

=item * JSON::XS

=item * Object::Tiny

=item * Try::Tiny

=item * Params::Util

=back

=head2 cpanm

Other instructions will come later, when ControlFreak will be on CPAN.

  # install cpanm (see App::cpanminus documentation for details)
  cd ~/bin
  wget http://xrl.us/cpanm
  chmod +x cpan

  ## install cpan version
  cpanm ControlFreak

  ## install bleeding edge
  cpanm http://github.com/yannk/ControlFreak/tarball/master

=head1 BASICS

When ControlFreak daemon C<cfkd> is started, it opens a management socket
that allows operators and programs to sennd instructions to the daemon.

The daemon duty is to fork and exec services, making sure that they are
running or stopped according to commands received. C<cfkd> is also
configured with logging capabilities, in such way that STDOUT and STDERR
of the services it has the responsibities of, aren't lost.

=head1 SIMPLE EXAMPLE

=head2 Start cfkd with a config file and use cfkctl

    # run in the background:
    $ cfkd -d

    # alternatively, run cfkd in it's own shell/term in the foreground:
    $ cfkd

You can know use C<cfkctl> to inspect C<cfkd> status. This control script
connects by default to a unix socket at C</tmp/cfkd.sock>.

  $ perl cfkctl status
  # nothing! Expectingly there is no service declared in cfkd

  # declare a new svc1 service with a 'sleep 100' as the command
  $ cfkctl load - <<END
  service svc1 cmd=sleep 100
  END

  $ perl cfkctk status
  stopped svc1

  # let's start the service we have
  $ cfkctl start svc1
  $ cfkctl status
  running svc1                   2 seconds ago (Wed Nov 11 16:16:09 2009)
  $ cfkctl stop svc1
  $ cfkctl status



( run in 0.896 second using v1.01-cache-2.11-cpan-39bf76dae61 )