Index: BOL/script_install_amaury/install_lmdz.sh
===================================================================
--- BOL/script_install_amaury/install_lmdz.sh	(revision 4995)
+++ BOL/script_install_amaury/install_lmdz.sh	(revision 4997)
@@ -95,4 +95,6 @@
     arch="local-gfortran"
     arch_dir=""
+
+    jobcmd=""
 }
 
@@ -148,4 +150,6 @@
 
         -make_j     number of processes to parallelize installations (default <$make_j>)
+
+        -jobcmd     command prepended to fcm compile jobs, e.g. "srun" (default <$jobcmd>)
 
         -noclean    will only download necessary files (but no thorough check is made on the integrity of existing files), and will recompile everything (very quick if it's already been compiled before)
@@ -187,4 +191,5 @@
             "-inlandsis") inlandsis=1; shift;;
             "-make_j") make_j=$2; shift; shift;;
+            "-jobcmd") jobcmd=$2; shift; shift;;
             "-noclean") clean_install=0; shift;;
             *)  bash install_lmdz.sh -h; exit 1
@@ -319,8 +324,8 @@
         getlog="$(pwd)/get.log"
         echo "logfile : $getlog"
-        myget "src_archives/$trusting/modipsl.$version.tar.gz" >> get.log 2>&1
+        myget "src_archives/$trusting/modipsl.$version.tar.gz" &>> get.log
         echo "install_lmdz.sh wget_OK $(date)"
-        gunzip "modipsl.$version.tar.gz" >> get.log 2>&1
-        tar xf "modipsl.$version.tar" >> get.log 2>&1
+        gunzip "modipsl.$version.tar.gz" &>> get.log
+        tar xf "modipsl.$version.tar" &>> get.log
         \rm "modipsl.$version.tar"
     fi
@@ -447,8 +452,8 @@
             echo "----------------------------------------------------------"
             echo "log file : $netcdflog"
-            myget script_install/$script_install_netcdf >> "$netcdflog" 2>&1
+            myget script_install/$script_install_netcdf &>> "$netcdflog"
             chmod u=rwx $script_install_netcdf
             # shellcheck disable=SC2086
-            ./$script_install_netcdf -prefix "$ncdfdir" $opt_ >> "$netcdflog" 2>&1
+            ./$script_install_netcdf -prefix "$ncdfdir" $opt_ &>> "$netcdflog"
         fi
 
@@ -506,6 +511,9 @@
     echo "Compiling IOIPSL, the interface library with Netcdf $(date) (log: $ioipsllog)"
 
-    if ! ./makeioipsl_fcm -arch "$arch" -job 8 > "$ioipsllog" 2>&1; then
-        echo "IOIPSL compile failed, exiting"; exit 1
+    echo "$jobcmd ./makeioipsl_fcm -j $make_j -arch $arch" > compile.sh
+    chmod +x compile.sh
+    echo "Compiling IOIPSL using $(\cat compile.sh)"
+    if ! ./compile.sh &> "$ioipsllog"; then
+        echo "STOP: IOIPSL compile failed, exiting"; exit 1
     fi
 
@@ -536,6 +544,6 @@
 
         echo "Starting XIOS compilation"
-        if ! ./make_xios --arch "$arch" --job 8 > "$xioslog" 2>&1; then
-            echo "XIOS compilation failed, exiting"; exit 1
+        if ! ./make_xios --arch "$arch" --job 8 &> "$xioslog"; then
+            echo "STOP: XIOS compilation failed, exiting"; exit 1
         fi
 
@@ -550,5 +558,5 @@
         "none") fcm_veget_version="false";;
         "orch2.0" | "CMIP6") fcm_veget_version=orchidee2.0; fetch_rev=7906;;  # in previous tar we used 6592 but with some modifications to xios_orchidee.f90, which got integrated in 7906
-        "orch2.2") fcm_veget_version=orchidee2.1; orcbranch="ORCHIDEE_2_2" ;; # the bundled version
+        "orch2.2") fcm_veget_version=orchidee2.1; orcbranch="/branches/ORCHIDEE_2_2/ORCHIDEE" ;; # the bundled version
         *) fetch_rev=$veget; fcm_veget_version=orchidee2.1;;  # /!\ arbitary rev only works for orch>=2.1
     esac
@@ -597,18 +605,12 @@
         fi
 
-        if [[ $parallel = "none" ]]; then
-            echo "./makeorchidee_fcm $xios_orchid $opt_orc -parallel none -arch $arch -j $make_j" > compile.sh
-        else
-            if [[ ! -d src_parallel ]]; then
-               echo "Orchidee version too old for parallel support"; exit 1
-            fi
-            {
-                echo "./makeorchidee_fcm -j $make_j $xios_orchid $opt_orc -parallel $parallel -arch $arch"
-            } > compile.sh
-        fi
+        if [[ $parallel != "none" && ! -d src_parallel ]]; then
+           echo "STOP: Orchidee version too old for parallel support"; exit 1
+        fi
+        echo "$jobcmd ./makeorchidee_fcm -j $make_j $xios_orchid $opt_orc -parallel $parallel -arch $arch" > compile.sh
         chmod +x compile.sh
         echo "Compiling ORCHIDEE using $(\cat compile.sh)"
-        if ! ./compile.sh > "$orchideelog" 2>&1; then
-            echo "ORCHIDEE compilation failed, exiting"; exit 1
+        if ! ./compile.sh &> "$orchideelog"; then
+            echo "STOP: ORCHIDEE compilation failed, exiting"; exit 1
         fi
         echo "Compiled ORCHIDEE $(date)"
@@ -622,21 +624,22 @@
 
     if [[ -n $svn_lmdz ]]; then
-      local curr_rev
-      curr_rev=$(svn info "$MODEL/modipsl/modeles/LMD"* | grep Revision: | cut -d ":" -f 2)
-      if [[ $svn_lmdz != "$curr_rev" ]]; then
-          local lmdzbranch
-          echo "Fetching LMDZ $svn_lmdz from the repository"
-          lmdzbranch=$(svn log -v -q https://svn.lmd.jussieu.fr/LMDZ -r "$svn_lmdz" | grep LMDZ | head -1 | sed -e 's:trunk/.*$:trunk:' | awk '{print $2}')
-          cd "$MODEL/modipsl/modeles"
-          rm -rf LMD*
-          svn co -r "$svn_lmdz" "https://svn.lmd.jussieu.fr/LMDZ$lmdzbranch" LMDZ
-          cd - > /dev/null
-      fi
+        local curr_rev
+        curr_rev=$(svn info "$MODEL/modipsl/modeles/LMD"* | grep Revision: | cut -d ":" -f 2)
+        if [[ $svn_lmdz != "$curr_rev" ]]; then
+            local lmdzbranch
+            echo "Fetching LMDZ $svn_lmdz from the repository"
+            lmdzbranch=$(svn log -v -q https://svn.lmd.jussieu.fr/LMDZ -r "$svn_lmdz" | grep LMDZ | head -1 | sed -e 's:trunk/.*$:trunk:' | awk '{print $2}')
+            cd "$MODEL/modipsl/modeles"
+            rm -rf LMD*
+            svn co -r "$svn_lmdz" "https://svn.lmd.jussieu.fr/LMDZ$lmdzbranch" LMDZ
+            cd - > /dev/null
+        fi
+        used_lmdz_rev=$svn_lmdz
     else  # get svn from info
-         set +e; used_lmdz_rev=$(svn info | grep "Last Changed Rev" | cut -c 19-); set -e
-         if [[ -z $used_lmdz_rev ]]; then  # svn info failed
+        set +e; used_lmdz_rev=$(svn info | grep "Last Changed Rev" | cut -c 19-); set -e
+        if [[ -z $used_lmdz_rev ]]; then  # svn info failed
             used_lmdz_rev=$(grep 'Revision: [0-9]' "$MODEL"/Read*.md | awk ' { print $2 } ' 2>/dev/null)
             if [[ -z $used_lmdz_rev ]]; then echo "Could not determine lmdz version. This is likely an issue with the .tar itself, please report to LMDZ team."; exit 1; fi
-         fi
+        fi
     fi
 }
@@ -671,9 +674,9 @@
     makelmdz="makelmdz_fcm $optim_debug -arch $arch -j $make_j"
     local para_compile_opt="-mem -parallel $parallel"; if [[ $parallel = "none" ]]; then para_compile_opt=""; fi
-    echo "./$makelmdz $opt_rad $opt_cosp $opt_makelmdz_xios $opt_aer $opt_inlandsis $opt_isotopes -p $compphysiq -d ${grid_resolution} -v $fcm_veget_version $para_compile_opt gcm" > compile.sh
+    echo "$jobcmd ./$makelmdz $opt_rad $opt_cosp $opt_makelmdz_xios $opt_aer $opt_inlandsis $opt_isotopes -p $compphysiq -d ${grid_resolution} -v $fcm_veget_version $para_compile_opt gcm" > compile.sh
     echo "Compiling lmdz using $(\cat compile.sh) (log: $lmdzlog) $(date)"
     chmod +x ./compile.sh
-    if ! ./compile.sh > "$lmdzlog" 2>&1; then
-        echo "LMDZ compilation failed, exiting"; exit 1
+    if ! ./compile.sh &> "$lmdzlog"; then
+        echo "STOP: LMDZ compilation failed, exiting"; exit 1
     fi
     echo "Finished LMDZ compilation $(date)"
@@ -681,5 +684,5 @@
     # Check executable
     if [[ ! -f $exe_name ]]; then
-        echo "Compilation failed, can't find the executable"; exit 1
+        echo "STOP: Compilation failed, can't find the executable"; exit 1
     else
         echo "Compilation successfull, the executable is $exe_name $(date)"
@@ -809,11 +812,11 @@
                 echo "ulimit -s unlimited" >> bench.sh
             fi
-            if which mpirun > /dev/null 2>&1; then
-                echo "mpirun -np 2 gcm.e > listing 2>&1" >> bench.sh
+            if which mpirun &> /dev/null; then
+                echo "mpirun -np 2 gcm.e &> listing" >> bench.sh
             elif grep -q "Adastra" /etc/motd; then
                 local account
                 account=$(/usr/sbin/my_project.py -l 2>&1 | head -1 | cut -d " " -f 3- | cut -c 5-)
                 bench_cmd="srun --nodes=1 --ntasks=1 --cpus-per-task=2 --threads-per-core=2 --time=0:10:00 --constraint=GENOA --account=$account bash bench.sh"
-                echo "./gcm.e > listing 2>&1" >> bench.sh
+                echo "./gcm.e &> listing" >> bench.sh
             else
                 echo "Error: No command found to run parallel bench"; exit 1
@@ -831,5 +834,5 @@
 EOF
         else
-            echo "./gcm.e > listing 2>&1" > bench.sh
+            echo "./gcm.e &> listing" > bench.sh
         fi
         # Getting orchidee stuff
@@ -877,5 +880,5 @@
         echo "EXECUTION DU BENCH"
         date
-        if (! $bench_cmd > out.bench 2>&1) || ! (tail -n 1 listing | grep "Everything is cool"); then
+        if (! $bench_cmd &> out.bench) || ! (tail -n 1 listing | grep "Everything is cool"); then
             tail listing
             echo "Bench FAILED, exiting"; exit 1
@@ -899,5 +902,5 @@
  		    fi
         echo "Running 1D/run.sh, log in $(pwd)/run1d.log"
-        ./run.sh > "$(pwd)/run1d.log" 2>&1
+        ./run.sh &> "$(pwd)/run1d.log"
     fi
 }
