diff options
| -rwxr-xr-x | mini-dinstall | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/mini-dinstall b/mini-dinstall index f0f8ce4..a777b27 100755 --- a/mini-dinstall +++ b/mini-dinstall @@ -265,12 +265,21 @@ def process_exists(pid): return True if os.access(lockfilename, os.R_OK): - pid = int(open(lockfilename).read()) - if not process_exists(pid): + pid = open(lockfilename).read() + error = '' + if not pid: + error = "Lockfile present but empty; use mini-dinstall -k to remove it" + warn = "Lockfile present but empty, removing it" + else: + pid = int(pid) + if not process_exists(pid): + error = "No process running at %d; use mini-dinstall -k to remove lockfile" % pid + warn = "No process running at %d, removing lockfile" % pid + if error: if run_mode: - logger.error("No process running at %d; use mini-dinstall -k to remove lockfile") + logger.error(error) sys.exit(1) - logger.warn("No process running at %d, removing lockfile" % pid) + logger.warn(warn) os.unlink(lockfilename) if kill_mode: sys.exit(0) |
