-def die_if_already_running():
- """If a locked pidfile exists, issue a warning message and, unless
- ignore_existing_pidfile() has been called, terminate the program."""
- if _pidfile is None:
- return
- pid = read_pidfile_if_exists(_pidfile)
- if pid > 0:
- if not _overwrite_pidfile:
- msg = "%s: already running as pid %d" % (_pidfile, pid)
- logging.error("%s, aborting" % msg)
- sys.stderr.write("%s\n" % msg)
- sys.exit(1)
- else:
- logging.warn("%s: %s already running"
- % (get_pidfile(), ovs.util.PROGRAM_NAME))