Conscience Core
Functions
conscience_utils::systemutils Namespace Reference

Functions

void sleepMillis (double millis)
 
string executeSystemCommand (const string &cmd, int *outExitCode=nullptr)
 Executes a shell command and returns its output as a string. More...
 
string getOSDistribution ()
 
string getCpuArchitecture ()
 
void deleteFilesOlderThan (const string &directoryPath, const string &fileNamePattern, int days)
 
vector< string > getIPV4Addresses ()
 
vector< string > getReachableIPV4Networks ()
 
size_t getProcessMemoryUsageMB ()
 

Function Documentation

◆ deleteFilesOlderThan()

void conscience_utils::systemutils::deleteFilesOlderThan ( const string &  directoryPath,
const string &  fileNamePattern,
int  days 
)

Not compatible with windows at the moment

◆ executeSystemCommand()

string conscience_utils::systemutils::executeSystemCommand ( const string &  cmd,
int *  outExitCode = nullptr 
)

Executes a shell command and returns its output as a string.

Note
!! This function is POTENTIALLY BLOCKING if the command executed doesn't return or takes a long time to process !!
Parameters
cmdThe shell command to be executed.
outExitCodeif not null, will be set to exit code
Returns
The output from the executed command as a string.
Exceptions
std::runtime_errorif popen() fails.

◆ getCpuArchitecture()

string conscience_utils::systemutils::getCpuArchitecture ( )

return the CPU architecture of this entity (aarch64, armv7l, ..)

◆ getIPV4Addresses()

vector< string > conscience_utils::systemutils::getIPV4Addresses ( )

◆ getOSDistribution()

string conscience_utils::systemutils::getOSDistribution ( )

return the distribution of the current OS

◆ getProcessMemoryUsageMB()

size_t conscience_utils::systemutils::getProcessMemoryUsageMB ( )

◆ getReachableIPV4Networks()

vector< string > conscience_utils::systemutils::getReachableIPV4Networks ( )

◆ sleepMillis()

void conscience_utils::systemutils::sleepMillis ( double  millis)