Skip to content

Commit

Permalink
Merge pull request #7 from georchestra/vrt-logfile
Browse files Browse the repository at this point in the history
Vrt-bot log in file
  • Loading branch information
f-necas authored Feb 16, 2024
2 parents 49b241e + bc5b8c7 commit 7105d93
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DOCKER_HUB.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# Featured tags

- `latest`, `23.0.x`
- `latest`

# Quick reference

Expand Down
15 changes: 8 additions & 7 deletions vrt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ set -e
# horodatage pour commentaires
DATE=$(date "+%A %d/%m/%Y %H:%M:%S")


rm -f ${SOURCEDIR}/vrtbot.log
touch ${SOURCEDIR}/vrtbot.log

if [ -n "$(ls -A $SOURCEDIR 2>/dev/null)" ]
then
Expand All @@ -33,21 +34,21 @@ DATE=$(date "+%A %d/%m/%Y %H:%M:%S")
# cycle vrt
for vrt in *.vrt;
do
echo "import de ${SOURCEDIR}/${vrt} dans le schema ${ACTIVESCHEMA} de la base ${PGDATABASE}"
echo "import de ${SOURCEDIR}/${vrt} dans le schema ${ACTIVESCHEMA} de la base ${PGDATABASE}" | tee -a vrtbot.log
/usr/bin/ogr2ogr \
-f Postgresql \
-overwrite \
PG:"active_schema=${ACTIVESCHEMA}" "${vrt}" -lco SCHEMA=${ACTIVESCHEMA} -lco OVERWRITE=yes -lco GEOMETRY_NAME=geometry -nlt PROMOTE_TO_MULTI -lco DESCRIPTION="import par ${JOB_NAME}/${BUILD_NUMBER} le ${DATE} - ${SOURCEDIR}/${vrt}"
PG:"active_schema=${ACTIVESCHEMA}" "${vrt}" -lco SCHEMA=${ACTIVESCHEMA} -lco OVERWRITE=yes -lco GEOMETRY_NAME=geometry -nlt PROMOTE_TO_MULTI -lco DESCRIPTION="import par ${JOB_NAME}/${BUILD_NUMBER} le ${DATE} - ${SOURCEDIR}/${vrt}" 2>&1 | tee -a vrtbot.log
# post import sql
if [ -f "${vrt}.sql" ]; then
echo "script sql après import trouvé"
echo "script sql après import trouvé" | tee -a vrtbot.log
source "settings"
psql -f "${vrt}.sql"
echo "script sql après import exécuté"
psql -f "${vrt}.sql" | tee -a vrtbot.log
echo "script sql après import exécuté" | tee -a vrtbot.log

fi
done

else
echo "${SOURCEDIR} n'existe pas"
echo "${SOURCEDIR} n'existe pas" | tee -a vrtbot.log
fi

0 comments on commit 7105d93

Please sign in to comment.