summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/feed2imap/feed2imap.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/feed2imap/feed2imap.rb b/lib/feed2imap/feed2imap.rb
index 250a0e7..77bd48e 100644
--- a/lib/feed2imap/feed2imap.rb
+++ b/lib/feed2imap/feed2imap.rb
@@ -65,7 +65,13 @@ class Feed2Imap
if not File::exist?(@config.cache)
@logger.warn("Cache file #{@config.cache} not found, using a new one")
else
- File::open(@config.cache) { |f| @cache.load(f) }
+ File::open(@config.cache) do |f|
+ if not f.flock(File::LOCK_UN)
+ @logger.fatal("Another instance of feed2imap is already locking the cache file")
+ exit(1)
+ end
+ @cache.load(f)
+ end
end
# connecting all IMAP accounts
@logger.info('Connecting to IMAP accounts')
2008-03-06Used better exceptions for configuration parserRené 'Necoro' Neumann1-26/+114 2008-03-06Update translationRené 'Necoro' Neumann2-349/+393 2008-03-06Update createpot.shRené 'Necoro' Neumann1-3/+2 2008-03-06Use 'nofork' instead of 'nolistener'René 'Necoro' Neumann1-3/+3 2008-03-05Install glade files into template dir and not data dirRené 'Necoro' Neumann2-2/+1 2008-03-05Added dependency listRené 'Necoro' Neumann3-117/+237