From 96612562db8bfd4bb156b285606f7de6fd08c27f Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sat, 13 Jul 2002 23:38:16 +0000 Subject: Added commands buildstats buildkeys and buildthesaurus --- Echolot/Commands.pm | 8 +++++- Echolot/Config.pm | 4 +-- NEWS | 3 +++ pingd | 77 ++++++++++++++++++++++++++++++++--------------------- 4 files changed, 58 insertions(+), 34 deletions(-) diff --git a/Echolot/Commands.pm b/Echolot/Commands.pm index d5ef445..41b9804 100644 --- a/Echolot/Commands.pm +++ b/Echolot/Commands.pm @@ -1,7 +1,7 @@ package Echolot::Commands; # (c) 2002 Peter Palfrader -# $Id: Commands.pm,v 1.5 2002/07/03 11:08:21 weasel Exp $ +# $Id: Commands.pm,v 1.6 2002/07/13 23:37:55 weasel Exp $ # =pod @@ -69,6 +69,12 @@ sub processCommands($) { Echolot::Globals::get()->{'storage'}->set_stuff(@args); } elsif ($command eq 'getkeyconf') { Echolot::Globals::get()->{'scheduler'}->schedule('getkeyconf', time() ); + } elsif ($command eq 'buildstats') { + Echolot::Globals::get()->{'scheduler'}->schedule('buildstats', time() ); + } elsif ($command eq 'buildkeys') { + Echolot::Globals::get()->{'scheduler'}->schedule('buildkeys', time() ); + } elsif ($command eq 'buildthesaurus') { + Echolot::Globals::get()->{'scheduler'}->schedule('buildthesaurus', time() ); } elsif ($command eq 'delete') { Echolot::Globals::get()->{'storage'}->delete_remailer(@args); } elsif ($command eq 'setremailercaps') { diff --git a/Echolot/Config.pm b/Echolot/Config.pm index 06460f5..42af3e0 100644 --- a/Echolot/Config.pm +++ b/Echolot/Config.pm @@ -1,7 +1,7 @@ package Echolot::Config; # (c) 2002 Peter Palfrader -# $Id: Config.pm,v 1.24 2002/07/13 20:35:50 weasel Exp $ +# $Id: Config.pm,v 1.25 2002/07/13 23:37:55 weasel Exp $ # =pod @@ -78,11 +78,11 @@ sub init($) { ping_every_nth_time => 48, # send out pings to the same remailer every 48 calls, i.e. every 4 hours buildstats => 5*60, # build statistics every 5 minutes buildkeys => 8*60*60, # build keyring every 8 hours + buildthesaurus => 60*60, # hourly commitprospectives => 8*60*60, # commit prospective addresses every 8 hours expire => 24*60*60, # daily getkeyconf => 24*60*60, # daily check_resurrection => 7*24*60*60, # weekly - build_thesaurus => 60*60, # hourly resultdir => 'results', thesaurusdir => 'results/thesaurus', diff --git a/NEWS b/NEWS index d50f549..7dc7d02 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +Changes in version + * Added commands buildstats buildkeys and buildthesaurus + Changes in version 2.0beta13 - 2002-07-12 * Have correct title tags and some layout changes in the HTML templates * Encode HTML Entities in HTML Stats diff --git a/pingd b/pingd index c8d45e2..59928cf 100755 --- a/pingd +++ b/pingd @@ -3,7 +3,7 @@ $| = 1; # (c) 2002 Peter Palfrader -# $Id: pingd,v 1.39 2002/07/13 21:23:02 weasel Exp $ +# $Id: pingd,v 1.40 2002/07/13 23:37:55 weasel Exp $ # =pod @@ -34,6 +34,12 @@ pingd - echolot ping daemon =item B B +=item B B + +=item B B + +=item B B + =item B B =back @@ -124,6 +130,18 @@ the next valid remailer-conf reply by the remailer. Send a command to immediatly request keys and configuration from remailers. +=item B + +Send a command to immediatly rebuild stats. + +=item B + +Send a command to immediatly rebuild the keyrings. + +=item B + +Send a command to immediatly rebuild the Thesaurus. + =item B Dumps the current configuration to standard output. @@ -149,7 +167,8 @@ Print version number and exit sucessfully. =item --nohup Usefull only with the B, B, B, -B or B command. +B, B, B, B, +or B command. Don't send a HUP signal to the daemon which instructs it to process the commands after adding the command to the task list. @@ -369,7 +388,7 @@ sub daemon_run($) { $scheduler->add('ping' , Echolot::Config::get()->{'pinger_interval'} , 0, \&Echolot::Pinger::send_pings ); $scheduler->add('buildstats' , Echolot::Config::get()->{'buildstats'} , 0, \&Echolot::Stats::build_stats ); $scheduler->add('buildkeys' , Echolot::Config::get()->{'buildkeys'} , 0, \&Echolot::Stats::build_keys ); - $scheduler->add('buildthesaurus' , Echolot::Config::get()->{'build_thesaurus'} , 0, \&Echolot::Thesaurus::build_thesaurus ); + $scheduler->add('buildthesaurus' , Echolot::Config::get()->{'buildthesaurus'} , 0, \&Echolot::Thesaurus::build_thesaurus ); $scheduler->add('commitprospectives' , Echolot::Config::get()->{'commitprospectives'} , 0, \&commit_prospective_address ); $scheduler->add('expire' , Echolot::Config::get()->{'expire'} , 0, \&expire ); @@ -444,7 +463,14 @@ sub make_dirs() { }; }; - +sub hup_if_wanted($) { + my ($nohup) = @_; + if (!$nohup && pid_exists()) { + daemon_hup() + } else { + print "Don't forget to run $PROGRAM_NAME process.\n"; + }; +}; @@ -492,39 +518,28 @@ Echolot::Globals::init(); if ($COMMAND eq 'add' || $COMMAND eq 'delete') { command_adddelete($COMMAND, @ARGV); - if (!$params->{'nohup'} && pid_exists()) { - daemon_hup() - } else { - print "Don't forget to run $PROGRAM_NAME process.\n"; - }; + hup_if_wanted($params->{'nohup'}); } elsif ($COMMAND eq 'set') { command_set(@ARGV); - if (!$params->{'nohup'} && pid_exists()) { - daemon_hup() - } else { - print "Don't forget to run $PROGRAM_NAME process.\n"; - }; -} elsif ($COMMAND eq 'setremailercaps') { - command_setremailercaps(@ARGV); - if (!$params->{'nohup'} && pid_exists()) { - daemon_hup() - } else { - print "Don't forget to run $PROGRAM_NAME process.\n"; - }; + hup_if_wanted($params->{'nohup'}); } elsif ($COMMAND eq 'deleteremailercaps') { command_deleteremailercaps(@ARGV); - if (!$params->{'nohup'} && pid_exists()) { - daemon_hup() - } else { - print "Don't forget to run $PROGRAM_NAME process.\n"; - }; + hup_if_wanted($params->{'nohup'}); +} elsif ($COMMAND eq 'setremailercaps') { + command_setremailercaps(@ARGV); + hup_if_wanted($params->{'nohup'}); } elsif ($COMMAND eq 'getkeyconf') { Echolot::Commands::addCommand("getkeyconf"); - if (!$params->{'nohup'} && pid_exists()) { - daemon_hup() - } else { - print "Don't forget to run $PROGRAM_NAME process.\n"; - }; + hup_if_wanted($params->{'nohup'}); +} elsif ($COMMAND eq 'buildstats') { + Echolot::Commands::addCommand("buildstats"); + hup_if_wanted($params->{'nohup'}); +} elsif ($COMMAND eq 'buildkeys') { + Echolot::Commands::addCommand("buildkeys"); + hup_if_wanted($params->{'nohup'}); +} elsif ($COMMAND eq 'buildthesaurus') { + Echolot::Commands::addCommand("buildthesaurus"); + hup_if_wanted($params->{'nohup'}); } elsif ($COMMAND eq 'process') { daemon_hup(); } elsif ($COMMAND eq 'stop') { -- cgit v1.2.3