lmotta

create_cbers4_catalog

May 4th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.15 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. ## Functions
  4. format_time(){
  5.   # deltatime=$1
  6.   minutes=$(echo "$1/60" | bc)
  7.   seconds=$(echo "$1%60" | bc)
  8.   ftime="$minutes:$seconds"
  9. }
  10. #
  11. print_status_process(){
  12.   if [ ! "$step" -eq "0" ]; then
  13.     local timenow=$(date -u +"%s")
  14.     local perc=$(echo "scale=4;$step/$total*100" | bc)
  15.     local ftime=""
  16.     local deltatime=$(echo "$timenow-$timeini" | bc)
  17.     local lefttime=$(echo "scale=4;($deltatime/$step)*($total-$step)" | bc)
  18.     format_time $deltatime
  19.     local fdeltatime=$ftime
  20.     format_time $lefttime
  21.     local flefttime=$ftime
  22.     printf "\r%-100s" "$step/$total($perc %) - times(minutes:seconds): $fdeltatime(elapsed) $flefttime(left)"
  23.   fi
  24. }
  25. #
  26. ## Process variable
  27. shp="catalog_inpe_cbers4.shp"
  28. title="Append Geojson's in '"$shp"'"
  29. lst="LIST_OF_IMAGES"
  30. ##
  31. dateini=$(date +"%Y%m%d %H:%M:%S")
  32. echo
  33. echo $title" - Started "$dateini
  34. #
  35. total=$(cat $lst | wc -l)
  36. step='0'
  37. timeini=$(date -u +"%s")
  38. for item in $(cat $lst)
  39. do
  40.  print_status_process
  41.  #
  42.  footprint_append_shp.sh $item $shp >/dev/null
  43.  #
  44.  step=$(echo "$step+1" | bc)
  45. done
  46. #
  47. dateend=$(date +"%Y%m%d %H:%M:%S")
  48. echo
  49. echo "Finished "$dateend
Advertisement
Add Comment
Please, Sign In to add comment