def stop(botname):
    """
    This method of stopping a bot is only required if you have backgrounded
    or otherwise daemonized its process, and it would run indefinitely otherwise.
    """
    _bot_exists(botname)
    cfg = ConfigParser.SafeConfigParser()
    cfg.read('%s/settings.cfg' % botname)
    pidfile = cfg.get('bot', 'pidfile')
    if os.path.exists(pidfile):
        # Delete the pidfile. This will message the process
        pid = -1
        try:
            f = open(pidfile, "r")
            pid = int(f.readline().strip())
            f.close()
            os.remove(pidfile)
        except __HOLE__:
            print 'Unable to read PID file. Perhaps "%s" is not running?' % botname
        except OSError, err:
            err = str(err)
            print err
        print 'Sent process %s a halt signal.' % pid
    else:
        print 'PID file "%s" does not exist. Perhaps "%s" is not running?' % (pidfile, botname)
dataset/ETHPy150Open magsol/pybot/pybot/bootstrap.py/stop