mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 00:31:14 +00:00
shmmonitor: daemon output to file if FAIRMQ_SHMMONITOR_VERBOSE is true
This commit is contained in:
parent
be55565617
commit
9144258b89
|
@ -227,8 +227,15 @@ class Manager
|
|||
|
||||
boost::filesystem::path p = boost::process::search_path("fairmq-shmmonitor", ownPath);
|
||||
|
||||
bool verbose = false;
|
||||
if (const char* verboseEnv = getenv("FAIRMQ_SHMMONITOR_VERBOSE")) {
|
||||
if (std::string(verboseEnv) == "true") {
|
||||
verbose = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!p.empty()) {
|
||||
boost::process::spawn(p, "-x", "-m", "--shmid", id, "-d", "-t", "2000", env);
|
||||
boost::process::spawn(p, "-x", "-m", "--shmid", id, "-d", "-t", "2000", verbose ? "--verbose" : "", env);
|
||||
int numTries = 0;
|
||||
do {
|
||||
try {
|
||||
|
|
|
@ -86,6 +86,7 @@ int main(int argc, char** argv)
|
|||
bool debug = false;
|
||||
bool cleanOnExit = false;
|
||||
bool getShmId = false;
|
||||
bool verbose = false;
|
||||
int userId = -1;
|
||||
|
||||
options_description desc("Options");
|
||||
|
@ -103,6 +104,7 @@ int main(int argc, char** argv)
|
|||
("clean-on-exit,e", value<bool>(&cleanOnExit)->implicit_value(true), "Perform cleanup on exit")
|
||||
("interval" , value<unsigned int>(&intervalInMS)->default_value(100), "Output interval for interactive mode")
|
||||
("get-shmid" , value<bool>(&getShmId)->implicit_value(true), "Translate given session id and user id to a shmem id (uses current user id if none provided)")
|
||||
("verbose" , value<bool>(&verbose)->implicit_value(true), "Verbose mode (daemon will output to a file 'fairmq-shmmonitor_log_<timestamp>')")
|
||||
("user-id" , value<int>(&userId)->default_value(-1), "User id (used with --get-shmid)")
|
||||
("help,h", "Print help");
|
||||
|
||||
|
@ -117,6 +119,9 @@ int main(int argc, char** argv)
|
|||
notify(vm);
|
||||
|
||||
if (runAsDaemon) {
|
||||
if (verbose) {
|
||||
fair::Logger::InitFileSink("trace", "fairmq-shmmonitor_log");
|
||||
}
|
||||
daemonize();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user