From b285ce7d6c99d200d7c1d46d8cf4dfcde3caae00 Mon Sep 17 00:00:00 2001 From: caremoli Date: Thu, 27 Aug 2009 16:12:13 +0000 Subject: [PATCH] CCAR: I have added a way to define the directory for the container log files If the environment variable SALOME_TMP_DIR is defined and is a directory the log files are created in this directory and not in /tmp. This modification has only be done for Linux and only for the container logs. Other temporary files go in /tmp as before. --- src/Container/SALOME_ContainerManager.cxx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index cc3a42c7b..a110ba69d 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -321,7 +321,17 @@ SALOME_ContainerManager::StartContainer(const Engines::MachineParameters& params string logFilename=getenv("TEMP"); logFilename += "\\"; #else - string logFilename="/tmp/"; + string logFilename="/tmp"; + char* val = getenv("SALOME_TMP_DIR"); + if(val) + { + struct stat file_info; + stat(val, &file_info); + bool is_dir = S_ISDIR(file_info.st_mode); + if (is_dir)logFilename=val; + else std::cerr << "SALOME_TMP_DIR environment variable is not a directory use /tmp instead" << std::endl; + } + logFilename += "/"; #endif logFilename += _NS->ContainerName(params)+"_"+ theMachine +"_"+getenv( "USER" )+".log" ; command += " > " + logFilename + " 2>&1"; -- 2.39.2