Added orchestrastatus management command

This commit is contained in:
Marc Aymerich 2016-01-11 14:08:47 +00:00
parent 19a0a76452
commit 48a9fe01a4
2 changed files with 8 additions and 2 deletions

View File

@ -454,4 +454,4 @@ mkhomedir_helper or create ssh homes with bash.rc and such
# Reverse lOgHistory order by date (lastest first)
* orchestrastatus command, showing if it is runningg, in what URL and stuff
* setuppostgres use porject_name for db name and user instead of orchestra

View File

@ -41,7 +41,7 @@ class Command(BaseCommand):
self.stdout.write(" %(service)s offline" % context)
if service == 'nginx':
try:
config_path = '/etc/nginx/conf.d/%(project_name)s.conf' % context
config_path = '/etc/nginx/sites-enabled/%(project_name)s.conf' % context
with open(config_path, 'r') as handler:
config = handler.read().replace('\n', ' ')
except FileNotFoundError:
@ -65,6 +65,12 @@ class Command(BaseCommand):
self.stdout.write(" * DB connection failed")
else:
self.stdout.write(" * DB connection succeeded")
elif service == 'uwsgi':
uwsgi_config = '/etc/uwsgi/apps-enabled/%(project_name)s.ini' % context
if os.path.isfile(uwsgi_config):
self.stdout.write(" * %s exists" % uwsgi_config)
else:
self.stdout.write(" * %s does not exist" % uwsgi_config)
cronbeat = 'crontab -l | grep "^.*/orchestra-beat %(site_dir)s/manage.py"' % context
if run(cronbeat, valid_codes=(0, 1)).exit_code == 0:
self.stdout.write(" cronbeat installed")