Avoid to use nohup to start the gcore container

This commit is contained in:
Antonio Calanducci 2023-10-25 11:49:20 +02:00
parent f0b0bb3b1d
commit a93b11ea47
2 changed files with 50 additions and 0 deletions

View File

@ -43,6 +43,7 @@ RUN rm /home/gcube/gCore/lib/is-publisher-2.2.0-4.2.0-126946.jar
RUN wget -P /home/gcube/gCore/lib https://nexus.d4science.org/nexus/content/repositories/gcube-releases-gcore/org/gcube/informationsystem/is-publisher/2.2.1-4.15.0-181697/is-publisher-2.2.1-4.15.0-181697.jar
COPY src/gcube-start-container.sh /home/gcube/gCore/bin/gcore-start-container
COPY src/gcore-start-container-daemon /home/gcube/gCore/bin/gcore-start-container-daemon
COPY src/GHNConfig.xml /home/gcube/gCore/config/GHNConfig.xml
COPY src/container-log4j.properties /home/gcube/gCore/

View File

@ -0,0 +1,49 @@
#! /bin/sh
#
# Portions of this file Copyright 1999-2005 University of Chicago
# Portions of this file Copyright 1999-2005 The University of Southern California.
#
# This file or a portion of this file is licensed under the
# terms of the Globus Toolkit Public License, found at
# http://www.globus.org/toolkit/download/license.html.
# If you redistribute this file, with or without
# modifications, you must include this notice in the file.
#
RESTART_DELAY=20
RESTART_FILE=$GLOBUS_LOCATION/config/.restart
RESTART_AND_CLEAN_FILE=$GLOBUS_LOCATION/config/.restartAndClean
#kill the running daemons (if any)
rm -rf nohup.out 1>/dev/null 2>&1
ps -fwww -u $LOGNAME | grep "org.globus.wsrf.container.ServiceContainer" | grep -v grep | grep -v $$ | awk '{print $2}' | xargs -n1 kill -9 1>/dev/null 2>&1
#give the time to close the socket correctly
sleep 1
$GLOBUS_LOCATION/bin/gcore-start-container-reboot "$@"
while [ 1 ]; do
sleep 10
if [ -e $RESTART_FILE ]; then
rm -rf $RESTART_FILE
sleep $RESTART_DELAY
$GLOBUS_LOCATION/bin/gcore-start-container-reboot "$@"
fi
if [ -e $RESTART_AND_CLEAN_FILE ]; then
rm -rf $RESTART_AND_CLEAN_FILE
sleep $RESTART_DELAY
#clean up the state
rm -f $GLOBUS_LOCATION/config/GHNProfile.xml* 2>&1 1>/dev/null
rm -f $GLOBUS_LOCATION/etc/*/RIProfile.xml* 2>&1 1>/dev/null
rm -rf $HOME/.gcore/ 2>&1 1>/dev/null
#restart
$GLOBUS_LOCATION/bin/gcore-start-container-reboot "$@"
fi
done