Fix checking pid file on startup

This commit is contained in:
JonnyWong16 2020-08-29 12:29:22 -07:00
parent 95fc108d57
commit f24f4a4250
No known key found for this signature in database
GPG key ID: 7A649674469E6574

View file

@ -149,11 +149,13 @@ def main():
try:
with open(plexpy.PIDFILE, 'r') as fp:
pid = int(fp.read())
os.kill(pid, 0)
except IOError as e:
raise SystemExit("Unable to read PID file: %s", e)
try:
os.kill(pid, 0)
except OSError:
logger.warn("PID file '%s' already exists, but PID %d is " \
logger.warn("PID file '%s' already exists, but PID %d is "
"not running. Ignoring PID file." %
(plexpy.PIDFILE, pid))
else: