diff --git a/src/agent/src/unix_daemon.cpp b/src/agent/src/unix_daemon.cpp index 6c9db036f3..f91f228a75 100644 --- a/src/agent/src/unix_daemon.cpp +++ b/src/agent/src/unix_daemon.cpp @@ -86,7 +86,6 @@ namespace unix_daemon if (!file.is_open()) { - LogCritical("Error opening file: {}({}) {}", filename.c_str(), errno, std::strerror(errno)); return 0; } diff --git a/src/agent/src/unix_daemon.hpp b/src/agent/src/unix_daemon.hpp index 0a1f3d5533..13faebe828 100644 --- a/src/agent/src/unix_daemon.hpp +++ b/src/agent/src/unix_daemon.hpp @@ -6,6 +6,7 @@ namespace unix_daemon { + /// @brief A class for handling PID files. class PIDFileHandler { public: @@ -25,9 +26,16 @@ namespace unix_daemon bool writePIDFile() const; bool removePIDFile() const; + /// @brief The method uses the readlink() function to read the path of the current executable file. + /// @return A string representing the current process' executable path. static std::string GetExecutablePath(); }; + /// @brief Returns the current status of the daemon. + /// @return A string representing the daemon's status. std::string GetDaemonStatus(); + + /// @brief Generates a PID file for the daemon. + /// @return A PIDFileHandler object that will delete the generated PID file on destruction (RAII style). PIDFileHandler GeneratePIDFile(); } // namespace unix_daemon