generate_symlinks.sh 777 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #! /bin/bash
  2. if [ -z "$1" ]
  3. then
  4. echo "No argument supplied"
  5. echo "Need to specify orval you want to use (in /scratch folder)"
  6. exit 1
  7. fi
  8. if [ -z "$2" ]
  9. then
  10. echo "No argument supplied"
  11. echo "Need to specify where you want to store data"
  12. exit 1
  13. fi
  14. echo "Creating links into /scratch folder"
  15. scratch="/scratch"
  16. orval=$1
  17. path=$2
  18. for link in {"data","results","logs","saved_models","models_info","models_backup","threshold_map","learned_zones","custom_norm"}; do
  19. if [ -L ${link} ]; then
  20. rm ${link}
  21. fi
  22. fullpath=${scratch}/${orval}/${path}/${link}
  23. if [ ! -d "${fullpath}" ]; then
  24. mkdir -p ${fullpath}
  25. fi
  26. # remove `orval` name for running part
  27. ln -s ${scratch}/${path}/${link} ${link}
  28. done