def start(app, args):
    app.check()
    if os.path.exists(app.pid_path()):
        print "~ Oops. %s is already started! (or delete %s)" % (os.path.normpath(app.path), os.path.normpath(app.pid_path()))
        print "~"
        sys.exit(1)

    sysout = app.readConf('application.log.system.out')
    sysout = sysout!='false' and sysout!='off'
    if not sysout:
        sout = None
    else:
        sout = open(os.path.join(app.log_path(), 'system.out'), 'w')
    try:
        pid = subprocess.Popen(app.java_cmd(args), stdout=sout, env=os.environ).pid
    except __HOLE__:
        print "Could not execute the java executable, please make sure the JAVA_HOME environment variable is set properly (the java executable should reside at JAVA_HOME/bin/java). "
        sys.exit(-1)
    print "~ OK, %s is started" % os.path.normpath(app.path)
    if sysout:
      print "~ output is redirected to %s" % os.path.normpath(os.path.join(app.log_path(), 'system.out'))
    pid_file = open(app.pid_path(), 'w')
    pid_file.write(str(pid))
    print "~ pid is %s" % pid
    print "~"
dataset/ETHPy150Open eBay/restcommander/play-1.2.4/framework/pym/play/commands/daemon.py/start