コード例 #1
0
ファイル: commands.py プロジェクト: loleg/realms-wiki
def setup_upstart(**kwargs):
    """ Start upstart conf creation wizard
    """
    from realms.lib.util import upstart_script

    if in_virtualenv():
        app_dir = get_prefix()
        path = '/'.join(sys.executable.split('/')[:-1])
    else:
        # Assumed root install, not sure if this matters?
        app_dir = '/'
        path = None

    kwargs.update(dict(app_dir=app_dir, path=path))

    conf_file = '/etc/init/realms-wiki.conf'
    script = upstart_script(**kwargs)

    try:
        with open(conf_file, 'w') as f:
            f.write(script)
        green('Wrote file to %s' % conf_file)
    except IOError:
        with open('/tmp/realms-wiki.conf', 'w') as f:
            f.write(script)
        yellow("Wrote file to /tmp/realms-wiki.conf, to install type:")
        yellow("sudo mv /tmp/realms-wiki.conf /etc/init/realms-wiki.conf")

    click.echo()
    click.echo("Upstart usage:")
    green("sudo start realms-wiki")
    green("sudo stop realms-wiki")
    green("sudo restart realms-wiki")
    green("sudo status realms-wiki")
コード例 #2
0
ファイル: commands.py プロジェクト: gazpachoking/realms-wiki
def setup_upstart(**kwargs):
    """ Start upstart conf creation wizard
    """
    from realms.lib.util import upstart_script

    if in_virtualenv():
        app_dir = get_prefix()
        path = '/'.join(sys.executable.split('/')[:-1])
    else:
        # Assumed root install, not sure if this matters?
        app_dir = '/'
        path = None

    kwargs.update(dict(app_dir=app_dir, path=path))

    conf_file = '/etc/init/realms-wiki.conf'
    script = upstart_script(**kwargs)

    try:
        with open(conf_file, 'w') as f:
            f.write(script)
        green('Wrote file to %s' % conf_file)
    except IOError:
        with open('/tmp/realms-wiki.conf', 'w') as f:
            f.write(script)
        yellow("Wrote file to /tmp/realms-wiki.conf, to install type:")
        yellow("sudo mv /tmp/realms-wiki.conf /etc/init/realms-wiki.conf")

    click.echo()
    click.echo("Upstart usage:")
    green("sudo start realms-wiki")
    green("sudo stop realms-wiki")
    green("sudo restart realms-wiki")
    green("sudo status realms-wiki")
コード例 #3
0
ファイル: cli.py プロジェクト: tobegit3hub/realms-wiki
def setup_upstart(**kwargs):
    """ Start upstart conf creation wizard
    """
    from realms.lib.util import upstart_script

    if in_virtualenv():
        app_dir = get_prefix()
        path = '/'.join(sys.executable.split('/')[:-1])
    else:
        # Assumed root install, not sure if this matters?
        app_dir = '/'
        path = None

    kwargs.update(dict(app_dir=app_dir, path=path))

    conf_file = '/etc/init/realms-wiki.conf'

    with open('/etc/init/realms-wiki.conf', 'w') as f:
        f.write(upstart_script(**kwargs))

    green('Wrote file to %s' % conf_file)
    green("Type 'sudo start realms-wiki' to start")
    green("Type 'sudo stop realms-wiki' to stop")
    green("Type 'sudo restart realms-wiki' to restart")