diff --git a/src/service_runner.cpp b/src/service_runner.cpp index 8b3bb52..78bfdf0 100644 --- a/src/service_runner.cpp +++ b/src/service_runner.cpp @@ -44,7 +44,7 @@ bool service_runner::init(const std::string& server_name, const std::string& ser mRemote_service_config_path = get_remote_service_config_path(m_server_name, m_service_info.service_name); mRemote_service_template_path = get_remote_service_template_path(m_server_name, m_service_info.service_name); mRemote_service_env_file = get_remote_service_env_file(m_server_name, m_service_info.service_name); - + return !m_service_info.path.empty(); } @@ -152,7 +152,7 @@ bool service_runner::install() { // Run install script { std::string install_cmd = "'cd " + mRemote_service_template_path + - " && /bin/bash install.sh " + mRemote_service_env_file + "'"; + " && /bin/bash install.sh " + mRemote_service_config_path + "'"; bool ok= execute_ssh_command(install_cmd, "Failed to run install script"); if (!ok) return false; @@ -180,7 +180,7 @@ bool service_runner::uninstall() { if (script_exists) { std::string uninstall_cmd = "'cd " + mRemote_service_template_path + - " && /bin/bash _uninstall.sh " + mRemote_service_env_file + "'"; + " && /bin/bash _uninstall.sh " + mRemote_service_config_path + "'"; if (!execute_ssh_command(uninstall_cmd, "Failed to run uninstall script")) { std::cerr << "Warning: Uninstall script failed, but continuing with directory removal" << std::endl; } @@ -242,7 +242,7 @@ bool service_runner::run_command(const std::string& command) { // Run the generic command std::string run_cmd = "'cd " + mRemote_service_template_path + - " && /bin/bash " + script_path + " " + mRemote_service_env_file + "'"; + " && /bin/bash " + script_path + " " + mRemote_service_config_path + "'"; return execute_ssh_command(run_cmd, "Command returned error code: " + script_path); } @@ -335,7 +335,7 @@ service_runner::HealthStatus service_runner::is_healthy() } // Run status script, does not display output. - bool ok = execute_ssh_command("'cd " + mRemote_service_template_path + " && /bin/bash " + script_path + " " + mRemote_service_env_file + " > /dev/null 2>&1'", ""); + bool ok = execute_ssh_command("'cd " + mRemote_service_template_path + " && /bin/bash " + script_path + " " + mRemote_service_config_path + " > /dev/null 2>&1'", ""); if (!ok) return HealthStatus::UNHEALTHY; @@ -395,7 +395,7 @@ std::vector service_runner::get_ports() // Run the ports script and capture output std::string run_cmd = "'cd " + mRemote_service_template_path + - " && /bin/bash " + script_path + " " + mRemote_service_env_file + "'"; + " && /bin/bash " + script_path + " " + mRemote_service_config_path + "'"; // Create a temporary file to store the output std::string temp_file = "/tmp/dropshell_ports_" + std::to_string(getpid()); diff --git a/src/utils/directories.hpp b/src/utils/directories.hpp index 3a27b58..4e2fada 100644 --- a/src/utils/directories.hpp +++ b/src/utils/directories.hpp @@ -37,6 +37,7 @@ namespace dropshell { std::string get_remote_service_backups_path(const std::string &server_name, const std::string &service_name); std::string get_remote_service_env_file(const std::string &server_name, const std::string &service_name); + std::string get_remote_service_env_file_parent(const std::string &server_name, const std::string &service_name); } // namespace dropshell #endif