#! /bin/sh

cd /opt/scribeui/application/workspaces/portail/demo/data/
FILE=ftp://ftp.mrn.gouv.qc.ca/public/gestim/telechargements/Province_shape/titres_titles`date  --date='3 days ago' +"%y-%m-%d"`.zip
wget $FILE
rm -r titles titles.shp

mkdir titles
cd titles
unzip ../titres_titles`date  --date='3 days ago' +"%y-%m-%d"`.zip
cd ..
ogrtindex -write_absolute_path titles.shp titles/*.shp

#! /bin/sh

FILE=titres_titles`date  --date='3 days ago' +"%y-%m-%d"`.zip

cd /tmp/
FTPFILE=ftp://ftp.mrn.gouv.qc.ca/public/gestim/telechargements/Province_shape/`echo $FILE`
wget $FTPFILE


if [ -f "$FILE" ]
then
  mkdir titles
  cd titles
  unzip /tmp/$FILE
  for f in *.shp   
  do
    shptree $f
  done

  cd /opt/scribeui/application/workspaces/portail/demo/data/
  rm -r titles titles.*
  mv /tmp/titles ./
  ogrtindex -write_absolute_path titles.shp titles/*.shp
  shptree titles.shp
  chown  www-data.users titles titles.*
fi

Fix the data update script to make sure it works when no update available
Fix the data update script to make sure it works when no update available
