earlier exit when locked
This commit is contained in:
parent
b1b1e431da
commit
1eac2fa43d
1 changed files with 7 additions and 5 deletions
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/local/bin/ruby -w
|
||||
|
||||
# $Dwarf: ripnews.rb,v 1.59 2003/04/28 21:52:48 ward Exp $
|
||||
# $Dwarf: ripnews.rb,v 1.60 2003/05/24 12:05:57 ward Exp $
|
||||
# $Source$
|
||||
|
||||
require 'date'
|
||||
|
|
@ -236,7 +236,8 @@ def check_config
|
|||
}
|
||||
end
|
||||
|
||||
def lock(group)
|
||||
def lock
|
||||
group = @config.keys[0]
|
||||
if @config[group].has_key?("LOCKFILE")
|
||||
if FileTest.exists?(@config[group]["LOCKFILE"])
|
||||
# Should also detect stale locks here
|
||||
|
|
@ -250,7 +251,8 @@ def lock(group)
|
|||
end
|
||||
end
|
||||
|
||||
def unlock(group)
|
||||
def unlock
|
||||
group = @config.keys[0]
|
||||
File.unlink(@config[group]["LOCKFILE"])
|
||||
end
|
||||
|
||||
|
|
@ -415,6 +417,7 @@ defaults = {'-c' => "#{ENV['HOME']}/.ripnewsrc"}
|
|||
defaults = parse_options(defaults)
|
||||
parse_config(defaults)
|
||||
check_config
|
||||
lock
|
||||
|
||||
@maxfilelength = get_max_file_length(@config[@config.keys[0]]["TEMPDIR"])
|
||||
|
||||
|
|
@ -432,7 +435,6 @@ if Debuglevel > 2
|
|||
end
|
||||
|
||||
for group in @config.keys.sort
|
||||
lock(group)
|
||||
print "\nGetting articles for #{group}\n"
|
||||
@articles = Article.new(@config[group]["NNTPSERVER"], group, @config[group]["NEWSRCNAME"])
|
||||
# begin
|
||||
|
|
@ -481,7 +483,6 @@ for group in @config.keys.sort
|
|||
end
|
||||
end
|
||||
@articles.quit
|
||||
unlock(group)
|
||||
end
|
||||
|
||||
tend = Time.now
|
||||
|
|
@ -492,3 +493,4 @@ m=runtime%3600
|
|||
s=m%60
|
||||
m=m/60
|
||||
printf("Running time: %02d:%02d:%02d\n", h, m, s)
|
||||
unlock
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue