diff --git a/pylink b/pylink index 79307e7..0a9f504 100755 --- a/pylink +++ b/pylink @@ -21,6 +21,7 @@ if __name__ == '__main__': parser = argparse.ArgumentParser(description='Starts an instance of PyLink IRC Services.') parser.add_argument('config', help='specifies the path to the config file (defaults to pylink.yml)', nargs='?', default='pylink.yml') parser.add_argument("-v", "--version", help="displays the program version and exits", action='store_true') + parser.add_argument("-c", "--no-checkpid", help="disables pid file checking, breaks clientbot if used wrongly", action='store_true') parser.add_argument("-n", "--no-pid", help="skips generating PID files", action='store_true') args = parser.parse_args() @@ -35,6 +36,13 @@ if __name__ == '__main__': from pylinkirc import classes, utils, coremods log.info('PyLink %s starting...', __version__) + # Check for a pid file, unless told not to, + # this stops instance overlap, which wrecks clientbots + if not args.no_checkpid: + config = conf.confname + if os.path.exists("%s.pid" % config): + log.error("PID file exists!") + # Write a PID file unless specifically told not to. if not args.no_pid: with open('%s.pid' % conf.confname, 'w') as f: