From 378db2ff2f292577b309df2917dc4b9dcc53a228 Mon Sep 17 00:00:00 2001 From: LSmyrnaios Date: Thu, 15 Dec 2022 14:15:24 +0200 Subject: [PATCH] - Add an existence-check for the "publications_retriever"-JAR, before trying to make a backup, inside "installAndRun.sh". - Add a final logging message, right before the app shuts down. --- installAndRun.sh | 6 ++++-- .../java/eu/openaire/urls_worker/UrlsWorkerApplication.java | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/installAndRun.sh b/installAndRun.sh index ddf21c9..5f6216f 100755 --- a/installAndRun.sh +++ b/installAndRun.sh @@ -55,8 +55,10 @@ if [[ justInstall -eq 0 ]]; then cd libs || exit 4 git clone https://github.com/LSmyrnaios/PublicationsRetriever.git # We assume there is no previously source-code here, if so, it will be overwritten. - # Keep a backup of the existing JAR file. - mv ./publications_retriever-1.0-SNAPSHOT.jar ./publications_retriever-1.0-SNAPSHOT_BACKUP.jar + # Keep a backup of the previous JAR file, if it exists. + if [ -f ./publications_retriever-1.0-SNAPSHOT.jar ]; then + mv ./publications_retriever-1.0-SNAPSHOT.jar ./publications_retriever-1.0-SNAPSHOT_BACKUP.jar + fi cd PublicationsRetriever && sudo apt install -y maven && mvn clean install diff --git a/src/main/java/eu/openaire/urls_worker/UrlsWorkerApplication.java b/src/main/java/eu/openaire/urls_worker/UrlsWorkerApplication.java index ec4f84c..01b0ee4 100644 --- a/src/main/java/eu/openaire/urls_worker/UrlsWorkerApplication.java +++ b/src/main/java/eu/openaire/urls_worker/UrlsWorkerApplication.java @@ -96,6 +96,7 @@ public class UrlsWorkerApplication { } FullTextsController.deleteDirectory(-1); + logger.info("Exiting.."); } @Bean @@ -110,6 +111,7 @@ public class UrlsWorkerApplication { return source; } + @Bean public CommandLineRunner setServerBaseUrl(Environment environment, ServletWebServerApplicationContext webServerAppCtxt) {