Parcourir la source

Update of link generator

Jérôme BUISINE il y a 4 ans
Parent
commit
48775492bb
1 fichiers modifiés avec 22 ajouts et 5 suppressions
  1. 22 5
      generate_symlinks.sh

+ 22 - 5
generate_symlinks.sh

@@ -1,23 +1,40 @@
 #! /bin/bash
 #! /bin/bash
 
 
+
 if [ -z "$1" ]
 if [ -z "$1" ]
+  then
+    echo "No argument supplied"
+    echo "Need to specify orval you want to use (in /scratch folder)"
+    exit 1
+fi
+
+if [ -z "$2" ]
   then
   then
     echo "No argument supplied"
     echo "No argument supplied"
     echo "Need to specify where you want to store data"
     echo "Need to specify where you want to store data"
     exit 1
     exit 1
 fi
 fi
 
 
-path=$1
 
 
-for link in {"data","results","saved_models","models_infos","models_backup","threshold_map","learned_zones","custom_norm"}; do
+echo "Creating links into /scratch folder"
+
+scratch="scratch"
+orval=$1
+path=$2
+
+
+for link in {"data","results","saved_models","models_info","models_backup","threshold_map","learned_zones","custom_norm"}; do
     
     
     if [ -L ${link} ]; then
     if [ -L ${link} ]; then
         rm ${link}
         rm ${link}
     fi
     fi
     
     
-    if [ ! -d "${path}/${link}" ]; then
-        mkdir -p ${path}/${link}
+    fullpath=${scratch}/${orval}/${path}/${link}
+
+    if [ ! -d "${fullpath}" ]; then
+        mkdir -p ${fullpath}
     fi
     fi
     
     
-    ln -s ${path}/${link} ${link}
+    # remove `orval` name for running part
+    ln -s ${scratch}/${path}/${link} ${link}
 done
 done