diff --git a/proc/Envia2SciELOFast.bat b/proc/Envia2SciELOFast.bat index bc3c2b35c..183a66341 100644 --- a/proc/Envia2SciELOFast.bat +++ b/proc/Envia2SciELOFast.bat @@ -4,14 +4,15 @@ rem ===== Aumentar o espaco de variaveis de ambiente rem CONFIG.SYS rem -rem Envia2Medline +rem Envia2SciELOFast rem Parametro 1: path da producao da SciELO rem Parametro 2: arquivo com instrucoes de FTP rem Parametro 3: arquivo de log rem Parametro 4: cria / adiciona +rem Parametro 5: (Opcional) path alternativo da base de artigos rem Inicializa variaveis -export INFORMALOG=log/Envia2Medline.log +export INFORMALOG=log/Envia2SciELOFast.log export CISIS_DIR=cisis rem Verifica parametros @@ -34,7 +35,12 @@ call batch/CriaDiretorio.bat temp/transf2scielofast call batch/GeraIso.bat $1/title/title temp/transf2scielofast/title_full.iso call batch/CriaMaster.bat temp/transf2scielofast/artigo_full_temp -call batch/AppendMaster.bat $1/artigo/artigo temp/transf2scielofast/artigo_full_temp prc/apaga_autores_772.prc +ARTIGOSOURCE=$1/artigo/artigo +if [ "$5" != "" ] +then + ARTIGOSOURCE=$5 +fi +call batch/AppendMaster.bat ${ARTIGOSOURCE} temp/transf2scielofast/artigo_full_temp prc/apaga_autores_772.prc call batch/GeraIso.bat temp/transf2scielofast/artigo_full_temp temp/transf2scielofast/artigo_full.iso diff --git a/proc/GeraScielo.bat b/proc/GeraScielo.bat index 464249012..6d71516f2 100644 --- a/proc/GeraScielo.bat +++ b/proc/GeraScielo.bat @@ -58,6 +58,41 @@ call batch/GeraInvertido.bat ../bases-work/newissue/newissue fst/newissue.fst .. call batch/CriaRevistasNovas.bat $1 call batch/GeraIssues.bat $1 + +# ============================================================================== +# PROPOSITO: GeraArtigoFast.bat + +GERAPADRAO_STATUS="" +ARQUIVO_STATUS="temp/GeraArtigoFastGeraPadraoStatus.ctrl" + +# 1. Le o status removendo potenciais quebras de linha do Windows (\r) +if [ -f "${ARQUIVO_STATUS}" ] +then + GERAPADRAO_STATUS=$(tr -d '\r' < "${ARQUIVO_STATUS}" 2>/dev/null) +fi + +# 2. Desvio condicional para o modo FAST +if [ "${GERAPADRAO_STATUS}" == "RUNNING" ] +then + call batch/GeraArtigoFastLockCheck.bat ${ARQUIVO_STATUS} 72 tecnologia@scielo.org + + call batch/InformaLog.bat $0 dh === Executando Fluxo FAST (Status: RUNNING) === + + # Executa o batch especial para o fluxo rápido + call batch/GeraArtigoFast.bat $1 + + # Registra o fim antecipado no log e encerra com sucesso (exit 0) + call batch/InformaLog.bat $0 dh === Fim Antecipado (Fluxo FAST) === LOG gravado em: $INFORMALOG + + # Finaliza execucao com sucesso, mas sem finalizar de forma padrão + exit 0 +fi + +# ============================================================================== +# PROPOSITO: GeraArtigoFast.bat +echo "RUNNING" > "${ARQUIVO_STATUS}" +# ============================================================================== + call batch/GeraArtigo.bat $1 call batch/GeraFacCount.bat $1 @@ -78,4 +113,9 @@ call batch/ManutencaoOn.bat ../bases call batch/CopiaWork2Teste.bat ../bases-work ../bases call batch/ManutencaoOff.bat ../bases -call batch/InformaLog.bat $0 dh ===Fim=== LOG gravado em: $INFORMALOG +# ============================================================================== +# PROPOSITO: GeraArtigoFast.bat +echo "FINISHED" > "${ARQUIVO_STATUS}" +# ============================================================================== + +call batch/InformaLog.bat $0 dh ===Fim=== LOG gravado em: $INFORMALOG \ No newline at end of file diff --git a/proc/batch/GeraArtigoFast.bat b/proc/batch/GeraArtigoFast.bat new file mode 100644 index 000000000..f960e6e1e --- /dev/null +++ b/proc/batch/GeraArtigoFast.bat @@ -0,0 +1,16 @@ +rem GeraArtigoFast +rem Parametro 1: path producao Scielo + +call batch/VerifPresencaParametro.bat $0 @$1 path producao SciELO + +call batch/CriaDiretorio.bat ../bases-work/fast +call batch/CriaMaster.bat ../bases-work/fast/artigo + +$CISIS_DIR/mx $1/serial/title/title lw=9000 "pft=if v50='C' then 'call batch/AppendMaster.bat ../bases-work/',v68,'/',v68,x1,'../bases-work/fast/artigo',x1,'prc/d1930.prc'/ fi" now >temp/GeraArtigoFast.bat +batch/ifErrorLevel.bat $? batch/AchouErro.bat $0 mx $1/serial/title/title lw:9000 pft:call_GeraArtigo.bat +chmod 700 temp/GeraArtigoFast.bat +call temp/GeraArtigoFast.bat + +echo "GeraArtigoFast: Envia de bases title e artigo do bases-work para FTP para carga em ArticleMeta" +call Envia2SciELOFast.bat ../bases-work transf/Envia2SciELOFastLogOn.txt log/enviaGeraArtigoFast.log cria ../bases-work/fast/artigo +echo "GeraArtigoFast: Fim de envio de bases" diff --git a/proc/batch/GeraArtigoFastLockCheck.bat b/proc/batch/GeraArtigoFastLockCheck.bat new file mode 100644 index 000000000..ab2bd91a5 --- /dev/null +++ b/proc/batch/GeraArtigoFastLockCheck.bat @@ -0,0 +1,23 @@ +#!/bin/bash +ARQUIVO="${1:-temp/GeraArtigoFastGeraPadraoStatus.ctrl}" +LIMIAR="${2:-72}" +EMAIL="${3:-tecnologia@scielo.org}" + +[ -f "$ARQUIVO" ] || exit 0 +[ "$(tr -d '\r' < "$ARQUIVO")" == "RUNNING" ] || exit 0 + +MTIME=$(stat -c %Y "$ARQUIVO" 2>/dev/null || stat -f %m "$ARQUIVO") +IDADE=$(( ($(date +%s) - MTIME) / 3600 )) +[ "$IDADE" -ge "$LIMIAR" ] || exit 0 + +DESDE=$(date -d "@$MTIME" +%d/%m/%Y\ %H:%M:%S 2>/dev/null || date -r "$MTIME" +%d/%m/%Y\ %H:%M:%S) + +cat >temp/GeraArtigoFastGeraPadraoStatusMessage.txt <