download-publications.sh 419 B

123456789101112131415161718192021
  1. #!/bin/bash -e
  2. cd "$(dirname $0)"
  3. DBPATHNEW="$(jq -r '.DBPath' < config.json)"
  4. DBPATHPROD="${DBPATHNEW%-new}"
  5. DBPATHOLD="$DBPATHPROD-$(date +'%Y%m%d')";
  6. if [ "$DBPATHNEW" = "$DBPATHPROD" ]; then
  7. echo 'Cannot use this script in this configuration' >&2
  8. exit -1;
  9. fi
  10. ./download-publications
  11. cp "$DBPATHPROD" "$DBPATHOLD"
  12. (xz -9e "$DBPATHOLD" 2>/dev/null || rm -f "$DBPATHOLD")&
  13. mv "$DBPATHNEW" "$DBPATHPROD"
  14. exit 0