mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
synced 2025-10-29 18:02:29 +00:00
Initial checkin for username creation
This commit is contained in:
@@ -451,12 +451,25 @@ namespace uCentral {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MicroService::SavePID() {
|
||||||
|
try {
|
||||||
|
std::ofstream O;
|
||||||
|
O.open(Daemon()->DataDir() + "/pidfile",std::ios::binary | std::ios::trunc);
|
||||||
|
O << Poco::Process::id();
|
||||||
|
O.close();
|
||||||
|
} catch (...)
|
||||||
|
{
|
||||||
|
std::cout << "Could not save system ID" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int MicroService::main(const ArgVec &args) {
|
int MicroService::main(const ArgVec &args) {
|
||||||
|
|
||||||
MyErrorHandler ErrorHandler(*this);
|
MyErrorHandler ErrorHandler(*this);
|
||||||
Poco::ErrorHandler::set(&ErrorHandler);
|
Poco::ErrorHandler::set(&ErrorHandler);
|
||||||
|
|
||||||
if (!HelpRequested_) {
|
if (!HelpRequested_) {
|
||||||
|
SavePID();
|
||||||
Poco::Logger &logger = Poco::Logger::get(DAEMON_APP_NAME);
|
Poco::Logger &logger = Poco::Logger::get(DAEMON_APP_NAME);
|
||||||
logger.notice(Poco::format("Starting %s version %s.",DAEMON_APP_NAME, Version()));
|
logger.notice(Poco::format("Starting %s version %s.",DAEMON_APP_NAME, Version()));
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include "Poco/Crypto/Cipher.h"
|
#include "Poco/Crypto/Cipher.h"
|
||||||
#include "Poco/SHA2Engine.h"
|
#include "Poco/SHA2Engine.h"
|
||||||
#include "Poco/Net/HTTPServerRequest.h"
|
#include "Poco/Net/HTTPServerRequest.h"
|
||||||
|
#include "Poco/Process.h"
|
||||||
|
|
||||||
#include "uCentralTypes.h"
|
#include "uCentralTypes.h"
|
||||||
#include "SubSystemServer.h"
|
#include "SubSystemServer.h"
|
||||||
@@ -129,6 +130,9 @@ namespace uCentral {
|
|||||||
[[nodiscard]] MicroServiceMetaVec GetServices();
|
[[nodiscard]] MicroServiceMetaVec GetServices();
|
||||||
[[nodiscard]] bool IsValidAPIKEY(const Poco::Net::HTTPServerRequest &Request);
|
[[nodiscard]] bool IsValidAPIKEY(const Poco::Net::HTTPServerRequest &Request);
|
||||||
|
|
||||||
|
void SavePID();
|
||||||
|
inline uint64_t GetPID() { return Poco::Process::id(); };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool HelpRequested_ = false;
|
bool HelpRequested_ = false;
|
||||||
std::string LogDir_;
|
std::string LogDir_;
|
||||||
|
|||||||
Reference in New Issue
Block a user