Dear Home Owner, このページをアンテナに追加 RSSフィード

 | 

2006-03-01

Plagger::Plugin::Notify::Command::Shutdown  Plagger::Plugin::Notify::Command::Shutdown - Dear Home Owner, を含むブックマーク はてなブックマーク -  Plagger::Plugin::Notify::Command::Shutdown - Dear Home Owner,  Plagger::Plugin::Notify::Command::Shutdown - Dear Home Owner, のブックマークコメント

Plagger::Plugin::Notify::Command

lib/Plagger/Plugin/Notify/Command.pm

package Plagger::Plugin::Notify::Command;
use strict;
use base qw( Plagger::Plugin );

sub register {
    my($self, $context) = @_;

    $context->register_hook(
        $self,
        'publish.feed'     => \&update,
        'publish.finalize' => $self->can('command'),
    );
}

sub update {
    my ($self, $context, $args) = @_;
    $self->{count}++ if $args->{feed}->count;
}

1;

Plagger::Plugin::Notify::Command::Shutdown

lib/Plagger/Plugin/Notify/Command/Shutdown.pm

package Plagger::Plugin::Notify::Command::Shutdown;
use strict;
use base qw( Plagger::Plugin::Notify::Command );

sub command {
    my ($self, $context, $args) = @_;
    system qq(shutdown -h now "You've got feed!") if $self->{count};
}

1;

config.yaml

  - module: Notify::Command::Shutdown

You need to run Plagger as root.

thanx id:tokuhirom, typestar

miyagawamiyagawa2006/03/01 14:54無関係だけど、
- feed:
- url: http...
- url: http...
で1個のBlockに複数かけます

youpyyoupy2006/03/01 15:05thanx

トラックバック - http://subtech.g.hatena.ne.jp/youpy/20060301
 |