diff --git a/src/server_env.cpp b/src/server_env.cpp index 1e4c730..dacdb6f 100644 --- a/src/server_env.cpp +++ b/src/server_env.cpp @@ -79,7 +79,7 @@ std::string server_env::construct_standard_command_run_cmd(const std::string &se std::map env_vars; get_all_service_env_vars(service_name, env_vars); - std::string argstr = quote(remote_service_config_path); + std::string argstr = ""; for (const auto& arg : args) { argstr += " " + quote(dequote(trim(arg))); } diff --git a/src/service_runner.cpp b/src/service_runner.cpp index cc427be..bd5b101 100644 --- a/src/service_runner.cpp +++ b/src/service_runner.cpp @@ -274,14 +274,7 @@ HealthStatus service_runner::is_healthy() return HealthStatus::ERROR; } - // Check if status script exists - std::string command = "status"; - - if (!template_command_exists(m_service_info.template_name, command)) { - return HealthStatus::UNKNOWN; - } - - std::string script_path = mRemote_service_template_path + "/" + command + ".sh"; + std::string script_path = get_remote_service_template_path(m_server_name, m_service_info.service_name) + "/status.sh"; if (!m_server_env.check_remote_file_exists(script_path)) { std::cerr << "Service is not installed: " << m_service_info.service_name << std::endl; return HealthStatus::NOTINSTALLED; @@ -319,7 +312,7 @@ std::string service_runner::HealthStatus2String(HealthStatus status) else if (status == HealthStatus::UNHEALTHY) return ":cross:"; else if (status == HealthStatus::UNKNOWN) - return ":question:"; + return ":greytick:"; else if (status == HealthStatus::NOTINSTALLED) return ":warning:"; else diff --git a/src/utils/tableprint.cpp b/src/utils/tableprint.cpp index fadfbf0..4d2d184 100644 --- a/src/utils/tableprint.cpp +++ b/src/utils/tableprint.cpp @@ -36,7 +36,9 @@ const std::map kReplacements = { {":check:", {"+", kTextColor_Green}}, {":x:", {"x", kTextColor_Red}}, {":error:", {"!", kTextColor_Red}}, - {":question:", {"?", kTextColor_DarkGrey}} + {":question:", {"?", kTextColor_DarkGrey}}, + {":greytick:", {"+", kTextColor_LightGrey}}, + {":greycross:", {"x", kTextColor_LightGrey}} }; // Helper function to get ANSI color code diff --git a/templates/dropshell-agent/README.txt b/templates/dropshell-agent/README.txt index 03d2363..9466197 100644 --- a/templates/dropshell-agent/README.txt +++ b/templates/dropshell-agent/README.txt @@ -1,23 +1,3 @@ -DropShell Template Example - -Shell scripts defined in this folder are run as DropShell commands on the remote server (not locally!). -All scripts are passed the directory containing the server-specific service environment (SSSE) as an argument -(the environment file, along with any other server and service-specific files, is then in $1/service.env) - -The default SSSE file included when a new service is created is in example/service.env. This must exist, -and must at minimum contain the TEMPLATE= variable. - -The optional backups script gets a second argument, which is the backup file to create (a single tgz file). - -Mandatory scripts are: -- install.sh -- uninstall.sh -- start.sh -- stop.sh - -Optional standard scripts are: -- backup.sh -- status.sh -- ports.sh -- logs.sh +DropShell agent. +Required for health checks etc. diff --git a/templates/dropshell-agent/_allservicesstatus.sh b/templates/dropshell-agent/_allservicesstatus.sh index 020bea9..3124523 100644 --- a/templates/dropshell-agent/_allservicesstatus.sh +++ b/templates/dropshell-agent/_allservicesstatus.sh @@ -54,7 +54,3 @@ for SERVICE_NAME in ${SERVICE_NAMES}; do echo "${SERVICE_NAME}_HEALTH=${SERVICE_HEALTH}" echo "${SERVICE_NAME}_PORTS=${SERVICE_PORTS}" done - - - - diff --git a/templates/dropshell-agent/_default.env b/templates/dropshell-agent/_default.env new file mode 100644 index 0000000..792d600 --- /dev/null +++ b/templates/dropshell-agent/_default.env @@ -0,0 +1 @@ +# diff --git a/templates/dropshell-agent/start.sh b/templates/dropshell-agent/start.sh deleted file mode 100644 index deb0b12..0000000 --- a/templates/dropshell-agent/start.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -# START SCRIPT -# The start script is required for all templates. -# It is used to start the service on the server. -# It is called with the path to the server specific env file as an argument. - - diff --git a/templates/dropshell-agent/status.sh b/templates/dropshell-agent/status.sh deleted file mode 100644 index 79c337a..0000000 --- a/templates/dropshell-agent/status.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -# STATUS SCRIPT -# The status script is OPTIONAL. -# It is used to return the status of the service (0 is healthy, 1 is unhealthy). -# It is called with the path to the server specific env file as an argument. - -exit 0 diff --git a/templates/dropshell-agent/stop.sh b/templates/dropshell-agent/stop.sh deleted file mode 100644 index a735b58..0000000 --- a/templates/dropshell-agent/stop.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# STOP SCRIPT -# The stop script is required for all templates. -# It is used to stop the service on the server. -# It is called with the path to the server specific env file as an argument. - diff --git a/templates/example/install.sh b/templates/example/install.sh index 33b736b..741dfd7 100755 --- a/templates/example/install.sh +++ b/templates/example/install.sh @@ -38,4 +38,4 @@ _remove_container $CONTAINER_NAME || die "Failed to remove container ${CONTAINER bash ./start.sh $1 || die "Failed to start container ${CONTAINER_NAME}" echo "Installation of ${CONTAINER_NAME} complete" -echo "You can access the service at http://${SERVER}:{HOST_PORT}" +echo "You can access the service at http://${SERVER}:${HOST_PORT}" diff --git a/templates/example/start.sh b/templates/example/start.sh index 6f26de6..f160e53 100755 --- a/templates/example/start.sh +++ b/templates/example/start.sh @@ -6,7 +6,7 @@ # It is called with the path to the server specific env file as an argument. source "$(dirname "$0")/_common.sh" -check_required_env_vars "CONTAINER_NAME" "HOST_PORT" "CONTAINER_PORT" "LOCAL_DATA_FOLDER" +check_required_env_vars "CONTAINER_NAME" "HOST_PORT" "LOCAL_DATA_FOLDER" [ -d "${LOCAL_DATA_FOLDER}" ] || die "Local data folder ${LOCAL_DATA_FOLDER} does not exist." diff --git a/templates/watchtower/status.sh b/templates/watchtower/status.sh index 93162b7..c4909b9 100644 --- a/templates/watchtower/status.sh +++ b/templates/watchtower/status.sh @@ -12,4 +12,3 @@ _is_container_running $CONTAINER_NAME || die "Service is not running - did not f # || die "Service is not healthy - did not get OK response from /health endpoint." echo "Service is healthy" -exit 0