summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2003-06-06 10:36:23 +0000
committerPeter Palfrader <peter@palfrader.org>2003-06-06 10:36:23 +0000
commit4218368936ee0e3613d29903a333f334b65f63dd (patch)
treeea2ec0c26ab7a559d9fc6bfd6bbd21eda2c11438
parent5c5d3ec3d283b8454788dad1c72510c1eb4eaf71 (diff)
Regularily clean up temp dir
-rw-r--r--Echolot/Config.pm3
-rw-r--r--Echolot/Pinger/CPunk.pm10
-rw-r--r--Echolot/Tools.pm16
-rw-r--r--NEWS1
-rw-r--r--TODO3
-rwxr-xr-xpingd3
6 files changed, 26 insertions, 10 deletions
diff --git a/Echolot/Config.pm b/Echolot/Config.pm
index 6b1be41..8bd4e0f 100644
--- a/Echolot/Config.pm
+++ b/Echolot/Config.pm
@@ -1,7 +1,7 @@
package Echolot::Config;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Config.pm,v 1.62 2003/02/28 18:02:31 weasel Exp $
+# $Id: Config.pm,v 1.63 2003/06/06 10:36:23 weasel Exp $
#
=pod
@@ -124,6 +124,7 @@ sub init($) {
expire_thesaurus => 21*24*60*60, # 21 days
expire_chainpings => 12*24*60*60, # 12 days
expire_fromlines => 5*24*60*60, # 5 days
+ cleanup_tmpdir => 24*60*60, # daily
random_garbage => 8192,
diff --git a/Echolot/Pinger/CPunk.pm b/Echolot/Pinger/CPunk.pm
index 9379ee4..08bed0c 100644
--- a/Echolot/Pinger/CPunk.pm
+++ b/Echolot/Pinger/CPunk.pm
@@ -1,7 +1,7 @@
package Echolot::Pinger::CPunk;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: CPunk.pm,v 1.19 2003/02/22 19:08:55 weasel Exp $
+# $Id: CPunk.pm,v 1.20 2003/06/06 10:36:23 weasel Exp $
#
=pod
@@ -150,8 +150,8 @@ sub encrypt_to($$$$) {
unlink ($keyring.'~'); # gnupg does those evil backups
(defined $plaintextfile) and
- ( unlink ($plaintextfile) or
- Echolot::Log::warn("Cannot unlink tmp keyring '$plaintextfile'."),
+ (unlink ($plaintextfile) or
+ Echolot::Log::warn("Cannot unlink tmp plaintextfile '$plaintextfile'."),
return undef);
@@ -167,8 +167,8 @@ sub encrypt_to($$$$) {
return 0;
(defined $plaintextfile) and
- ( unlink ($plaintextfile) or
- Echolot::Log::warn("Cannot unlink tmp keyring '$plaintextfile'."),
+ (unlink ($plaintextfile) or
+ Echolot::Log::warn("Cannot unlink tmp plaintextfile '$plaintextfile'."),
return undef);
$result =~ s,^Version: .*$,Version: N/A,m;
diff --git a/Echolot/Tools.pm b/Echolot/Tools.pm
index fd86a4c..c3ad305 100644
--- a/Echolot/Tools.pm
+++ b/Echolot/Tools.pm
@@ -1,7 +1,7 @@
package Echolot::Tools;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Tools.pm,v 1.22 2003/06/06 09:32:37 weasel Exp $
+# $Id: Tools.pm,v 1.23 2003/06/06 10:36:23 weasel Exp $
#
=pod
@@ -363,6 +363,20 @@ sub read_file($;$) {
return $result;
};
+sub cleanup_tmp() {
+ my $tmpdir = Echolot::Config::get()->{'tmpdir'};
+
+ opendir(DIR, $tmpdir) or
+ Echolot::Log::warn("Could not open '$tmpdir': $!."),
+ return undef;
+ my @files = grep { ! /^[.]/ } readdir(DIR);
+ closedir(DIR);
+
+ for my $file (@files) {
+ unlink($tmpdir.'/'.$file) or
+ Echolot::Log::warn("Could not unlink '$tmpdir/$file': $!.");
+ };
+};
1;
diff --git a/NEWS b/NEWS
index 08fb9f8..d425356 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ Changes in
* Remove random command invocation via pingctr/init script. People
should just call pingd directly. Also wait for pingd to really
shut down in stop and restart.
+ * Regularily clean up the temp directory.
Changes in version
* Minor documentation fixes suggested by Ryan Lackey.
diff --git a/TODO b/TODO
index 10d95b9..1cb85ff 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,4 @@
-$Id: TODO,v 1.60 2003/06/06 10:20:22 weasel Exp $
+$Id: TODO,v 1.61 2003/06/06 10:36:23 weasel Exp $
Legend:
- Not done
@@ -16,7 +16,6 @@ Legend:
- updated information with from lines
- optimize chain pinger:
cache callids in chainpinging - md5 is not that cheap
- - clean up tmp files
can be done later:
diff --git a/pingd b/pingd
index a713074..3a83fde 100755
--- a/pingd
+++ b/pingd
@@ -3,7 +3,7 @@
$| = 1;
# (c) 2002, 2003 Peter Palfrader <peter@palfrader.org>
-# $Id: pingd,v 1.107 2003/06/06 10:29:05 weasel Exp $
+# $Id: pingd,v 1.108 2003/06/06 10:36:23 weasel Exp $
#
=pod
@@ -555,6 +555,7 @@ sub daemon_run($) {
$scheduler->add('expire' , Echolot::Config::get()->{'expire'} , 0, 1, \&expire );
$scheduler->add('getkeyconf' , Echolot::Config::get()->{'getkeyconf_interval'} , 0, 0, \&Echolot::Conf::send_requests );
$scheduler->add('check_resurrection' , Echolot::Config::get()->{'check_resurrection'} , 0, 0, \&Echolot::Conf::check_resurrection );
+ $scheduler->add('cleanup_tmp' , Echolot::Config::get()->{'cleanup_tmpdir'} , 0, 1, \&Echolot::Tools::cleanup_tmp );
$scheduler->add('summary' , Echolot::Config::get()->{'summary'} , 0, 1, \&Echolot::Report::print_summary );