Salome HOME
Porting SALOME KERNEL to CMake
[modules/kernel.git] / src / Launcher / Launcher_Job_Command.cxx
index deec854b678bfc7935192b8335a2690d7cd6d10c..f325898ed5b2bdf5187ee71cdcdd9173d18dedca 100644 (file)
@@ -1,26 +1,36 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-// Author: AndrĂ© RIBES - EDF R&D
 
+// Author: AndrĂ© RIBES - EDF R&D
+//
 #include "Launcher_Job_Command.hxx"
 
-Launcher::Job_Command::Job_Command() {}
+#ifdef WITH_LIBBATCH
+#include <Batch/Batch_Constants.hxx>
+#endif
+
+#ifdef WNT
+#include <io.h>
+#define _chmod chmod
+#endif
+
+Launcher::Job_Command::Job_Command() {_job_type = "command";}
 
 Launcher::Job_Command::~Job_Command() {}
 
@@ -30,6 +40,7 @@ Launcher::Job_Command::update_job()
 #ifdef WITH_LIBBATCH
   Batch::Parametre params = common_job_params();
   params[Batch::EXECUTABLE] = buildCommandScript(params, _launch_date);
+  params[Batch::EXCLUSIVE] = false;
   _batch_job->setParametre(params);
 #endif
 }
@@ -48,7 +59,7 @@ Launcher::Job_Command::buildCommandScript(Batch::Parametre params, std::string l
   launch_script_stream.open(launch_script.c_str(), std::ofstream::out);
    
   // Script
-  launch_script_stream << "#! /bin/sh -f" << std::endl;
+  launch_script_stream << "#! /bin/bash -f" << std::endl;
   launch_script_stream << "cd " << work_directory << std::endl;
   launch_script_stream << "export PYTHONPATH=" << work_directory << ":$PYTHONPATH" << std::endl;
   launch_script_stream << "export PATH=" << work_directory << ":$PATH" << std::endl;