示例#1
0
            "Another instance of BrewPi is already running, which will conflict with this instance. "
            "This instance will exit")
    exit(0)

if checkStartupOnly:
    exit(1)

localJsonFileName = ""
localCsvFileName = ""
wwwJsonFileName = ""
wwwCsvFileName = ""
lastDay = ""
day = ""

if logToFiles:
    logPath = util.addSlash(util.scriptPath()) + 'logs/'
    logMessage(
        "Redirecting output to log files in %s, output will not be shown in console"
        % logPath)
    sys.stderr = open(logPath + 'stderr.txt', 'a',
                      0)  # append to stderr file, unbuffered
    sys.stdout = open(logPath + 'stdout.txt', 'w',
                      0)  # overwrite stdout file on script start, unbuffered


def startNewBrew(newName):
    global config
    if len(newName) > 1:  # shorter names are probably invalid
        config = util.configSet(configFile, dbConfig, 'beerName', newName)
        config = util.configSet(configFile, dbConfig, 'dataLogging', 'active')
        logMessage("Notification: Restarted logging for beer '%s'." % newName)
示例#2
0
        logMessage("Another instance of BrewPi is already running, which will conflict with this instance. "
                   "This instance will exit")
    exit(0)

if checkStartupOnly:
    exit(1)

localJsonFileName = ""
localCsvFileName = ""
wwwJsonFileName = ""
wwwCsvFileName = ""
lastDay = ""
day = ""

if logToFiles:
    logPath = util.addSlash(util.scriptPath()) + 'logs/'
    logMessage("Redirecting output to log files in %s, output will not be shown in console" % logPath)
    sys.stderr = open(logPath + 'stderr.txt', 'a', 0)  # append to stderr file, unbuffered
    sys.stdout = open(logPath + 'stdout.txt', 'w', 0)  # overwrite stdout file on script start, unbuffered


def startNewBrew(newName):
    global config
    if len(newName) > 1:     # shorter names are probably invalid
        config = util.configSet(configFile, dbConfig, 'beerName', newName)
        config = util.configSet(configFile, dbConfig, 'dataLogging', 'active')
        logMessage("Notification: Restarted logging for beer '%s'." % newName)
        return {'status': 0, 'statusMessage': "Successfully switched to new brew '%s'. " % urllib.unquote(newName) +
                                              "Please reload the page."}
    else:
        return {'status': 1, 'statusMessage': "Invalid new brew name '%s', "