Commit 69b5c920 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Script bash de lancement de l'import/synchro des publications HAL

parent 270d02c8
Loading
Loading
Loading
Loading
Loading
+42 −0
Original line number Diff line number Diff line
#!/usr/bin/env bash

#############################################################################################
#        Script de lancement de l'import et de la synchro des publications HAL.
#       (TODO: pouvoir cibler 1 établissement particulier comme ./run-import.sh)
#############################################################################################
#
# Variables d'env attendues :
#   Aucune !
#

CURR_DIR=$(cd `dirname $0` && pwd)
APP_DIR=$(cd ${CURR_DIR}/.. && pwd)

echo "Répertoire courant : $CURR_DIR"
echo "Répertoire de l'appli : $APP_DIR"

# Avorte si le script est déjà en cours d'exécution (avec les mêmes arguments)
LOCK_FILE=/run/$(basename $0).lock
echo "Lock file : $LOCK_FILE"
exec 200>$LOCK_FILE
flock -n 200
if [ $? -eq 1 ]; then
  echo "Script $(realpath $0) déjà en cours d'exécution ($LOCK_FILE). Stop !"
  exit 1
fi

echo

function run() {
  (
    set -x ;
    /usr/bin/php ${APP_DIR}/vendor/bin/laminas unicaen:db-import:run-import --name publications-hal && \
    /usr/bin/php ${APP_DIR}/vendor/bin/laminas unicaen:db-import:run-synchro --name publications-hal
  )
}

run

# Vidage du cache de résultat Doctrine
#rm -rf ${APP_DIR}/data/DoctrineModule/cache/*
${APP_DIR}/vendor/bin/doctrine-module orm:clear-cache:result