Skip to content

Commit

Permalink
added server management commands: list_apps, stop_app, start_app
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmark committed Nov 26, 2013
1 parent 86de8b8 commit cc153d8
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions fablib.py
Expand Up @@ -343,7 +343,6 @@ def reload_celery():
print(colors.red("You must set env.use_celery to True"))



@roles('admin')
def syncdb_destroy_database():
"""
Expand Down Expand Up @@ -637,13 +636,31 @@ def load_full_shell():
return prefix('source /etc/bash_completion')


@runs_once
def check_names():
"""
Check that everything is named in an acceptable fashion
"""
import re
if re.match(r'^[a-zA-Z][a-zA-Z_0-9]+$', env.project_name) is None:
raise SyntaxError('Project name contains invaild characters. It must be a valid python variable name.')
print(colors.red("Project name '%s' contains invaild characters. It should be a valid python variable name." % env.project_name))


# Server management
def list_apps():
run('ls -1 /etc/service/')


def stop_app(name=None):
if name is None:
name = env.project_name
sudo('sv stop %s' % name)


def start_app(name=None):
if name is None:
name = env.project_name
sudo('sv start %s' % name)


try:
Expand Down

0 comments on commit cc153d8

Please sign in to comment.