def stop(args): logger.info("Stopping ambari-server.") if (args != None): args.exit_message = None status, pid = is_server_runing() if status: try: os.kill(pid, signal.SIGTERM) except OSError, e: err = "Unable to stop Ambari Server - " + str(e) print_info_msg(err) raise FatalException(1, err) print "Waiting for server stop..." logger.info("Waiting for server stop...") if not wait_for_server_to_stop(SERVER_STOP_TIMEOUT): err = "Ambari-server failed to stop gracefully. Sending SIGKILL to it" print err logger.error(err) os.kill(pid, signal.SIGKILL) pid_file_path = os.path.join(configDefaults.PID_DIR, PID_NAME) os.remove(pid_file_path) print "Ambari Server stopped" logger.info("Ambari Server stopped")
def stop(args): logger.info("Stopping ambari-server.") if (args != None): args.exit_message = None status, pid = is_server_runing() if status: try: os.kill(pid, signal.SIGTERM) except OSError, e: print_info_msg("Unable to stop Ambari Server - " + str(e)) return print "Waiting for server stop..." logger.info("Waiting for server stop...") if not wait_for_server_to_stop(SERVER_STOP_TIMEOUT): print "Ambari-server failed to stop" logger.info("Ambari-server failed to stop") pid_file_path = os.path.join(configDefaults.PID_DIR, PID_NAME) os.remove(pid_file_path) print "Ambari Server stopped" logger.info("Ambari Server stopped")