CentOS support and enabled memcached at startup.

see #98
This commit is contained in:
Antoine Nguyen
2017-02-09 16:31:14 +01:00
parent 5f36d6231f
commit 8791766052
3 changed files with 12 additions and 5 deletions

View File

@@ -49,3 +49,11 @@ def add_user_to_group(user, group):
def enable_service(name):
"""Enable a service at startup."""
utils.exec_cmd("systemctl enable {}".format(name))
def enable_and_start_service(name):
"""Enable a start a service."""
enable_service(name)
code, output = utils.exec_cmd("service {} status".format(name))
action = "start" if code else "restart"
utils.exec_cmd("service {} {}".format(name, action))