handle empty lockfiles
This commit is contained in:
parent
d62c5c33e5
commit
6fcfacfad9
1 changed files with 12 additions and 7 deletions
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/local/bin/ruby -w
|
||||
|
||||
# $Dwarf: ripnews.rb,v 1.75 2003/07/13 11:18:09 ward Exp $
|
||||
# $Dwarf: ripnews.rb,v 1.76 2003/07/20 20:32:01 ward Exp $
|
||||
# $Source$
|
||||
|
||||
#
|
||||
|
|
@ -260,13 +260,18 @@ def lock
|
|||
lock = File.open(@config[group]["LOCKFILE"], "r")
|
||||
line = lock.gets
|
||||
lock.close
|
||||
line.chomp!
|
||||
psauxw = `ps -auxw`
|
||||
if /^\S+\s+#{line}\s+/.match(psauxw)
|
||||
print "Already running, exiting...\n"
|
||||
exit
|
||||
if line
|
||||
line.chomp!
|
||||
psauxw = `ps -auxw`
|
||||
if /^\S+\s+#{line}\s+/.match(psauxw)
|
||||
print "Already running, exiting...\n"
|
||||
exit
|
||||
else
|
||||
print "Stale lock found... removing...\n"
|
||||
File.unlink(@config[group]["LOCKFILE"])
|
||||
end
|
||||
else
|
||||
print "Stale lock found... removing...\n"
|
||||
print "Empty lockfile found... removing...\n"
|
||||
File.unlink(@config[group]["LOCKFILE"])
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue