From 68d86c7b1796d8846f432258acb0767778a4a844 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Wed, 9 Oct 2013 10:34:59 +0200 Subject: [PATCH] Correctly unlink lock files in indexer script --- root/etc/cron.daily/ajaxplorer-indexer | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/root/etc/cron.daily/ajaxplorer-indexer b/root/etc/cron.daily/ajaxplorer-indexer index f7c68bb..98c5930 100644 --- a/root/etc/cron.daily/ajaxplorer-indexer +++ b/root/etc/cron.daily/ajaxplorer-indexer @@ -28,7 +28,7 @@ foreach my $share ($a->get_all_by_prop(type => 'share')){ # Check if the lock file is present and if it's too old (last index crashed ?) if (-e "/var/cache/ajaxplorer/indexes/.ajxp_lock-$name"){ my $mtime = stat("/var/cache/ajaxplorer/indexes/.ajxp_lock-$name")->mtime; - unlink <"/var/cache/ajaxplorer/indexes/.ajxp_lock-$name"> + unlink if (time() - $mtime > 18000); } system('/usr/bin/sudo -u www /usr/bin/php /usr/share/ajaxplorer/cmd.php ' . @@ -36,7 +36,7 @@ foreach my $share ($a->get_all_by_prop(type => 'share')){ '-t=e71479ebc4365176d9f09fe957780024 -a=index '. '-r='.$name.' --secure_token='.$id.' --dir=/ --_method=put >/dev/null 2>&1'); # In some cases, the lock file is not removed, make sure it's unlocked - unlink <"/var/cache/ajaxplorer/indexes/.ajxp_lock-$name">; + unlink ; } # We should now restart OOo to release memory if (-d '/var/service/ooo'){