4 #$ENV{PERL5LIB}="plugins-scripts"; # Needed for utils.pm
6 unless ($ENV{DRUPAL_PASSWORD
}) {
7 die "Must set envvar for DRUPAL_PASSWORD";
10 my $pid = open(F
, "-|", qw(ssh -n -N -L 25555:127.0.0.1:3306 nagiosplugins.org));
12 # Allow time for ssh tunnel to be created
15 # To stop the death of ssh tunnel being defunct
16 $SIG{CHLD
} = 'IGNORE';
18 END { kill 'INT', $pid if $pid };
20 my $dbh = DBI
->connect("DBI:mysql:database=drupal;host=127.0.0.1;port=25555", "drupal", $ENV{DRUPAL_PASSWORD
});
23 push @plugin_paths, (grep { -x
$_ && -f
$_ } (<plugins
-root
/*>, <plugins/*>) );
25 foreach my $plugin_path (@plugin_paths) {
26 my $plugin = $plugin_path;
28 my $help_option = "--help";
29 $help_option = "-h" if ($plugin eq "check_icmp");
30 my $help = `$plugin_path $help_option` || die "Cannot run $plugin -h";
34 my $rows = $dbh->do("UPDATE node SET created=UNIX_TIMESTAMP(NOW()) WHERE title='$plugin'");
36 die "Cannot find $plugin in drupal to update - create book page first";
39 $dbh->do("UPDATE node_revisions SET timestamp=UNIX_TIMESTAMP(NOW()), log='Updated by update_online_manpage', teaser='$plugin --help', body=? WHERE title='$plugin'",
41 "<pre>".$help."</pre>");