|
|
@ -2,6 +2,7 @@ from cement.core.controller import CementBaseController, expose |
|
|
|
from cement.core import handler, hook |
|
|
|
from ee.core.services import EEService |
|
|
|
from ee.core.logging import Log |
|
|
|
from ee.core.variables import EEVariables |
|
|
|
|
|
|
|
|
|
|
|
class EEStackStatusController(CementBaseController): |
|
|
@ -28,8 +29,12 @@ class EEStackStatusController(CementBaseController): |
|
|
|
Log.debug(self, "php5-fpm service start") |
|
|
|
services = services + ['php5-fpm'] |
|
|
|
if self.app.pargs.mysql: |
|
|
|
Log.debug(self, "mysql service start") |
|
|
|
services = services + ['mysql'] |
|
|
|
if EEVariables.ee_mysql_host is "localhost": |
|
|
|
Log.debug(self, "mysql service start") |
|
|
|
services = services + ['mysql'] |
|
|
|
else: |
|
|
|
Log.warn(self, "Remote MySQL found," |
|
|
|
"unable to start MySQL service") |
|
|
|
if self.app.pargs.postfix: |
|
|
|
Log.debug(self, "postfix service start") |
|
|
|
services = services + ['postfix'] |
|
|
@ -39,9 +44,13 @@ class EEStackStatusController(CementBaseController): |
|
|
|
if self.app.pargs.dovecot: |
|
|
|
Log.debug(self, "dovecot service start") |
|
|
|
services = services + ['dovecot'] |
|
|
|
if not services: |
|
|
|
Log.debug(self, "nginx,php5-fpm,mysql,postfix services start") |
|
|
|
if not services and EEVariables.ee_mysql_host is "localhost": |
|
|
|
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix'] |
|
|
|
Log.debug(self, "nginx,php5-fpm,mysql,postfix services start") |
|
|
|
elif not services: |
|
|
|
services = services + ['nginx', 'php5-fpm', 'postfix'] |
|
|
|
Log.debug(self, "nginx,php5-fpm,postfix services start") |
|
|
|
|
|
|
|
for service in services: |
|
|
|
EEService.start_service(self, service) |
|
|
|
|
|
|
@ -56,8 +65,12 @@ class EEStackStatusController(CementBaseController): |
|
|
|
Log.debug(self, "php5-fpm service stop") |
|
|
|
services = services + ['php5-fpm'] |
|
|
|
if self.app.pargs.mysql: |
|
|
|
Log.debug(self, "mysql service stop") |
|
|
|
services = services + ['mysql'] |
|
|
|
if EEVariables.ee_mysql_host is "localhost": |
|
|
|
Log.debug(self, "mysql service stop") |
|
|
|
services = services + ['mysql'] |
|
|
|
else: |
|
|
|
Log.warn(self, "Remote MySQL found, " |
|
|
|
"unable to stop MySQL service") |
|
|
|
if self.app.pargs.postfix: |
|
|
|
Log.debug(self, "postfix service stop") |
|
|
|
services = services + ['postfix'] |
|
|
@ -67,9 +80,12 @@ class EEStackStatusController(CementBaseController): |
|
|
|
if self.app.pargs.dovecot: |
|
|
|
Log.debug(self, "dovecot service stop") |
|
|
|
services = services + ['dovecot'] |
|
|
|
if not services: |
|
|
|
if not services and EEVariables.ee_mysql_host is "localhost": |
|
|
|
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix'] |
|
|
|
Log.debug(self, "nginx,php5-fpm,mysql,postfix services stop") |
|
|
|
elif not services: |
|
|
|
services = services + ['nginx', 'php5-fpm', 'postfix'] |
|
|
|
Log.debug(self, "nginx,php5-fpm,postfix services stop") |
|
|
|
for service in services: |
|
|
|
EEService.stop_service(self, service) |
|
|
|
|
|
|
@ -84,8 +100,12 @@ class EEStackStatusController(CementBaseController): |
|
|
|
Log.debug(self, "php5-fpm service restart") |
|
|
|
services = services + ['php5-fpm'] |
|
|
|
if self.app.pargs.mysql: |
|
|
|
Log.debug(self, "mysql service restart") |
|
|
|
services = services + ['mysql'] |
|
|
|
if EEVariables.ee_mysql_host is "localhost": |
|
|
|
Log.debug(self, "mysql service restart") |
|
|
|
services = services + ['mysql'] |
|
|
|
else: |
|
|
|
Log.warn(self, "Remote MySQL found, " |
|
|
|
"unable to restart MySQL service") |
|
|
|
if self.app.pargs.postfix: |
|
|
|
Log.debug(self, "postfix service restart") |
|
|
|
services = services + ['postfix'] |
|
|
@ -95,10 +115,13 @@ class EEStackStatusController(CementBaseController): |
|
|
|
if self.app.pargs.dovecot: |
|
|
|
Log.debug(self, "dovecot service restart") |
|
|
|
services = services + ['dovecot'] |
|
|
|
if not services: |
|
|
|
if not services and EEVariables.ee_mysql_host is "localhost": |
|
|
|
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix'] |
|
|
|
for service in services: |
|
|
|
Log.debug(self, "nginx,php5-fpm,mysql,postfix services restart") |
|
|
|
elif not services: |
|
|
|
services = services + ['nginx', 'php5-fpm', 'postfix'] |
|
|
|
Log.debug(self, "nginx,php5-fpm,postfix services restart") |
|
|
|
for service in services: |
|
|
|
EEService.restart_service(self, service) |
|
|
|
|
|
|
|
@expose(help="Get stack status") |
|
|
@ -112,8 +135,12 @@ class EEStackStatusController(CementBaseController): |
|
|
|
Log.debug(self, "php5-fpm service status") |
|
|
|
services = services + ['php5-fpm'] |
|
|
|
if self.app.pargs.mysql: |
|
|
|
Log.debug(self, "mysql service status") |
|
|
|
services = services + ['mysql'] |
|
|
|
if EEVariables.ee_mysql_host is "localhost": |
|
|
|
Log.debug(self, "mysql service status") |
|
|
|
services = services + ['mysql'] |
|
|
|
else: |
|
|
|
Log.warn(self, "Remote MySQL found, " |
|
|
|
"unable to get MySQL service status") |
|
|
|
if self.app.pargs.postfix: |
|
|
|
services = services + ['postfix'] |
|
|
|
Log.debug(self, "postfix service status") |
|
|
@ -123,9 +150,12 @@ class EEStackStatusController(CementBaseController): |
|
|
|
if self.app.pargs.dovecot: |
|
|
|
Log.debug(self, "dovecot service status") |
|
|
|
services = services + ['dovecot'] |
|
|
|
if not services: |
|
|
|
Log.debug(self, "nginx,php5-fpm,mysql,postfix services status") |
|
|
|
if not services and EEVariables.ee_mysql_host is "localhost": |
|
|
|
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix'] |
|
|
|
Log.debug(self, "nginx,php5-fpm,mysql,postfix services status") |
|
|
|
elif not services: |
|
|
|
services = services + ['nginx', 'php5-fpm', 'postfix'] |
|
|
|
Log.debug(self, "nginx,php5-fpm,postfix services status") |
|
|
|
for service in services: |
|
|
|
if EEService.get_service_status(self, service): |
|
|
|
Log.info(self, "{0:10}: {1}".format(service, "Running")) |
|
|
@ -141,8 +171,12 @@ class EEStackStatusController(CementBaseController): |
|
|
|
Log.debug(self, "php5-fpm service reload") |
|
|
|
services = services + ['php5-fpm'] |
|
|
|
if self.app.pargs.mysql: |
|
|
|
Log.debug(self, "mysql service reload") |
|
|
|
services = services + ['mysql'] |
|
|
|
if EEVariables.ee_mysql_host is "localhost": |
|
|
|
Log.debug(self, "mysql service reload") |
|
|
|
services = services + ['mysql'] |
|
|
|
else: |
|
|
|
Log.warn(self, "Remote MySQL found, " |
|
|
|
"unable to remote MySQL service") |
|
|
|
if self.app.pargs.postfix: |
|
|
|
Log.debug(self, "postfix service reload") |
|
|
|
services = services + ['postfix'] |
|
|
@ -152,8 +186,11 @@ class EEStackStatusController(CementBaseController): |
|
|
|
if self.app.pargs.dovecot: |
|
|
|
Log.debug(self, "dovecot service reload") |
|
|
|
services = services + ['dovecot'] |
|
|
|
if not services: |
|
|
|
if not services and EEVariables.ee_mysql_host is "localhost": |
|
|
|
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix'] |
|
|
|
for service in services: |
|
|
|
Log.debug(self, "nginx,php5-fpm,mysql,postfix services reload") |
|
|
|
elif not services: |
|
|
|
services = services + ['nginx', 'php5-fpm', 'postfix'] |
|
|
|
Log.debug(self, "nginx,php5-fpm,postfix services reload") |
|
|
|
for service in services: |
|
|
|
EEService.reload_service(self, service) |
|
|
|