diff --git a/scripts/supybot-botchk b/scripts/supybot-botchk index bd9730fdf..f2924f49a 100644 --- a/scripts/supybot-botchk +++ b/scripts/supybot-botchk @@ -111,6 +111,13 @@ if __name__ == '__main__': debug('Pid %s is not the bot.' % pid) if not foundBot: + # First, we check if the pidfile is writable. If not, supybot will just exit, + # so we go ahead and refuse to start it. + try: + file(options.pidfile, 'r+') + except EnvironmentError, e: + debug('pidfile (%s) is not writable: %s' % (options.pidfile, e)) + sys.exit(-1) debug('Bot not found, starting.') home = os.environ['HOME'] inst = popen2.Popen4('sh')