]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
CCAR: I have added a way to define the directory for the container log files
authorcaremoli <caremoli>
Thu, 27 Aug 2009 16:12:13 +0000 (16:12 +0000)
committercaremoli <caremoli>
Thu, 27 Aug 2009 16:12:13 +0000 (16:12 +0000)
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

index cc3a42c7bd8c1ceb941c580b30ef1bac546bcddc..a110ba69dfabd53b6f307a5c8621b56ea8aa8d8e 100644 (file)
@@ -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";