#!/usr/bin/perl -w

use strict;

use Vulcan::Daemon;
use Vulcan::OptConf;

$| ++;

$Vulcan::OptConf::ARGC = 1;

my %o = Vulcan::OptConf->load()->get( qw( run kill ) )->dump();
my $daemon = Vulcan::Daemon->new( %o );

=head1 SYNOPSIS

Operate a daemontools service.

=head3 run

 $0 name --run

=cut
if ( $o{run} ) { $daemon->run() }

=head3 kill

 $0 name --kill

=cut
elsif ( $o{kill} ) { $daemon->kill() }

=head3 status

 $0 name

=cut
else { system sprintf "svstat %s", $daemon->path() }

exit 0;
