def service_del_boot(service): """Remove a service from the boot pipeline.""" if env.custom.operating_system == "ubuntu" or \ env.custom.operating_system == "debian": _x = mico_sudo("update-rc.d -f %s remove" % service) if env.custom.operating_system == "redhat" or \ env.custom.operating_system == "centos" or \ env.custom.operating_system == "fedora": _x = mico_sudo("chkconfig '%s' off" % service) mico.output.info("service %s removed to booting services" % service) return _x
def service_add_boot(service): """Add a service into the boot pipeline.""" if env.custom.operating_system == "ubuntu" or \ env.custom.operating_system == "debian": _x = mico_sudo("update-rc.d %s defaults" % service) if env.custom.operating_system == "redhat" or \ env.custom.operating_system == "centos" or \ env.custom.operating_system == "fedora": _x = mico_sudo("chkconfig '%s' on" % service) mico.output.info("service %s added to booting services" % service) return _x
def service_is_running(service): """Check if a service is running.""" with settings(hide('running', 'stdout', 'stderr', 'warnings'), warn_only=True): res = mico_sudo(service_string % { "service": service, "action": "status" }, force=True) return res.succeeded