summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog4
-rwxr-xr-xbin/hashl10
2 files changed, 12 insertions, 2 deletions
diff --git a/Changelog b/Changelog
index ba06ae9..f670ef5 100644
--- a/Changelog
+++ b/Changelog
@@ -1,7 +1,9 @@
git HEAD
* The internal representation of ignored hashes was changed
- * "hashl update" no longer re-adds ignored (but existing) files
+ * hashl update no longer re-adds ignored (but existing) files
+ * hashl update now saves its state when being interrupted
+ (sigint/sigterm)
hashl 0.1 - Fri May 06 2011
diff --git a/bin/hashl b/bin/hashl
index 6ae59c4..aaf17b9 100755
--- a/bin/hashl
+++ b/bin/hashl
@@ -65,6 +65,14 @@ else {
);
}
+$SIG{INT} = \&quit_save_db;
+$SIG{TERM} = \&quit_save_db;
+
+sub quit_save_db {
+ $hashl->save($db_file);
+ exit 0;
+}
+
sub get_total {
my $file = $File::Find::name;
if (-f $file and not -l $file and $file ne $db_file) {
@@ -157,7 +165,7 @@ sub process_file {
&{$code}($file, $path);
- if ($write and (($cur % 100) == 0)) {
+ if ($write and (($cur % 5000) == 0)) {
$hashl->save($db_file);
}
}