App-MonM

 view release on metacpan or  search on metacpan

bin/monmd  view on Meta::CPAN

# Prepare work directory
my $ddir = $ctk->datadir;
exit 1 unless CTK::Util::preparedir( $ddir );

# User and Group
my $usr = lvalue($ctk->config("daemonuser")) || USERNAME;
my $grp = lvalue($ctk->config("daemongroup")) || GROUPNAME;

# Set permisions (GID and UID) for work directory
my $uid = getpwnam($usr) || die "getpwnam failed - $!\n";
if ((stat($ddir))[4] != $uid) {
    my $gid = getgrnam($grp) || die "getgrnam failed - $!\n";
    chown($uid, $gid, $ddir);
}

# Daemon
my $daemon = App::MonM::Daemon->new(DAEMONMAME,
        ctk     => $ctk,
        forks   => lvalue($ctk->config("workers")) || App::MonM::Daemon::DAEMONFORKS,
        uid     => $usr,
        gid     => $grp,

lib/App/MonM.pm  view on Meta::CPAN

    printf("Config status       : %s\n", $self->conf("loadstatus") ? green("OK") : magenta("ERROR: not loaded"));
    $self->raise($self->configobj->error) if !$self->configobj->status and length($self->configobj->error);
    printf("Notifier class      : %s\n", ref($self->notifier) || magenta("not initialized"));
    #$self->debug(explain($self->config)) if $self->conf("loadstatus") && $self->verbosemode;

    # DB status
    printf("DB DSN              : %s\n", $store->dsn);
    printf("DB status           : %s\n", $store->error ? red("ERROR") : green("OK"));
    my $db_is_ok = $store->error ? 0 : 1;
    if ($db_is_ok && $store->{file} && -e $store->{file}) {
        my $s = File::stat::stat($store->{file})->size;
        printf("DB file             : %s\n", $store->{file});
        printf("DB size             : %s\n", sprintf("%s (%d bytes)", _fbytes($s), $s));
        printf("DB modified         : %s\n", _fdate(File::stat::stat($store->{file})->mtime || 0));
    }
    $self->raise($store->error) unless $db_is_ok;

    # Checkets
    my @checkits = getCheckitByName($self->config("checkit"));
    my $noc = scalar(@checkits);
    printf("Checkits            : %s\n", $noc ? $noc : yellow("none"));
    if ($noc) {
        #print explain(\@checkits);
        my $tbl = Text::SimpleTable->new(



( run in 0.972 second using v1.01-cache-2.11-cpan-49f99fa48dc )