From 1d78433ff8f8490ec942d6601ef800406355f6ca Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 19 May 2011 09:15:03 +0200 Subject: hashl update: Save db when being interrupted, increase autosave interval --- bin/hashl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'bin/hashl') 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); } } -- cgit v1.2.3