From c4115ae2a49295dea82702ddbeabb60eba614ed2 Mon Sep 17 00:00:00 2001 From: Nuno Date: Fri, 23 Apr 2021 02:18:40 +0200 Subject: [PATCH] Updated tools --- ryzom/server/tools/notify.sh | 32 ++++++++++++++++++++------ ryzom/server/tools/service_launcher.sh | 26 ++++++++++++++++----- 2 files changed, 45 insertions(+), 13 deletions(-) diff --git a/ryzom/server/tools/notify.sh b/ryzom/server/tools/notify.sh index 4e9ee9d49..7f9990b52 100644 --- a/ryzom/server/tools/notify.sh +++ b/ryzom/server/tools/notify.sh @@ -16,20 +16,38 @@ # COMMAND=$1 -shift CWD=$(dirname "$0") . "$CWD/config.sh" -if [[ "$COMMAND" = "ServiceStarted" ]] +echo $COMMAND +if [[ "$COMMAND" == "ServiceStarted" ]] then - if [[ -z "$NOTIFY_URL_SERVICE_RESTARTED" ]] + if [[ ! -z "$NOTIFY_URL_SERVICE_RESTARTED" ]] then - curl "$NOTIFY_URL_SERVICE_RESTARTED?command=started&shard=$(hostname -s)&apikey=$NOTIFY_URL_KEY&service=$2" + echo "nofitiy $(hostname -s):$2 started" + curl "$NOTIFY_URL_SERVICE_RESTARTED?command=started&shard=$(hostname -s)&apikey=$NOTIFY_URL_KEY&service=$2" & 2> /dev/null fi - -elif [[ "$COMMAND" = "ServiceStoped" ]] +elif [[ "$COMMAND" == "ServiceStopped" ]] then - curl "$NOTIFY_URL_SERVICE_RESTARTED?command=stoped&shard=$(hostname -s)&apikey=$NOTIFY_URL_KEY&service=$2" + if [[ ! -z "$NOTIFY_URL_SERVICE_RESTARTED" ]] + then + echo "nofitiy $(hostname -s):$2 stopped" + curl "$NOTIFY_URL_SERVICE_RESTARTED?command=stopped&shard=$(hostname -s)&apikey=$NOTIFY_URL_KEY&service=$2" & 2> /dev/null + fi +elif [[ "$COMMAND" == "ShardStopped" ]] +then + if [[ ! -z "$NOTIFY_URL_SERVICE_RESTARTED" ]] + then + echo "nofitiy $(hostname -s):$2 shard stopped" + curl "$NOTIFY_URL_SERVICE_RESTARTED?command=shard_stopped&shard=$(hostname -s)&apikey=$NOTIFY_URL_KEY" & 2> /dev/null + fi +elif [[ "$COMMAND" == "ShardStarted" ]] +then + if [[ ! -z "$NOTIFY_URL_SERVICE_RESTARTED" ]] + then + echo "nofitiy $(hostname -s):$2 shard started" + curl "$NOTIFY_URL_SERVICE_RESTARTED?command=shard_started&shard=$(hostname -s)&apikey=$NOTIFY_URL_KEY" & 2> /dev/null + fi fi diff --git a/ryzom/server/tools/service_launcher.sh b/ryzom/server/tools/service_launcher.sh index 3d9b73e95..4c74b61d5 100644 --- a/ryzom/server/tools/service_launcher.sh +++ b/ryzom/server/tools/service_launcher.sh @@ -27,7 +27,6 @@ shift CTRL_CMDLINE=$* - mkdir -p $NAME DOMAIN=shard @@ -71,24 +70,39 @@ do # we have a launch command so prepare, launch, wait for exit and do the housekeeping echo ----------------------------------------------------------------------- - echo Launching ... + echo Launching $(pwd) $EXECUTABLE $CTRL_CMDLINE... echo printf RUNNING > $STATE_FILE + #notify start + if [ "$NAME" = "egs" ] || [ "$NAME" = "ios" ] || [ "$NAME" = "gpms" ] + then + sleep 2 + elif [ "$NAME" = "ais_fyros" ] || [ "$NAME" = "ais_matis" ] || [ "$NAME" = "ais_tryker" ] || [ "$NAME" = "ais_roots" ] || [ "$NAME" = "ais_zorai" ] || [ "$NAME" = "ais_ark" ] + then + sleep 4 + fi + + echo "notifying $CWD/notify.sh ServiceStarted $NAME" "$CWD/notify.sh" ServiceStarted $NAME + export LC_ALL=C; unset LANGUAGE + if [[ "$USE_GDB" == "1" ]] then - if [ "$NAME" = "egs" ] || [ "$NAME" = "ios" ] || [ "$NAME" = "ais_fyros" ] || [ "$NAME" = "ais_matis" ] || [ "$NAME" = "ais_tryker" ] || [ "$NAME" = "ais_roots" ] || [ "$NAME" = "ais_zorai" ] || [ "$NAME" = "ais_ark" ] || [ "$NAME" = "ais_gpms" ] + if [ "$NAME" = "egs" ] || [ "$NAME" = "ios" ] || [ "$NAME" = "ais_fyros" ] || [ "$NAME" = "ais_matis" ] || [ "$NAME" = "ais_tryker" ] || [ "$NAME" = "ais_roots" ] || [ "$NAME" = "ais_zorai" ] || [ "$NAME" = "ais_ark" ] || [ "$NAME" = "gpms" ] then - gdb -batch -ex "set logging file $NAME/gdb_dump.txt" -ex "set logging on" -ex "run $CTRL_CMDLINE" -ex "bt" $EXECUTABLE + echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SHARD_PATH/lib gdb -batch -ex 'set logging file $NAME/gdb_dump.txt' -ex 'set logging on' -ex 'run $CTRL_CMDLINE' -ex 'bt' $EXECUTABLE" > /tmp/run_$NAME + else + echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SHARD_PATH/lib $EXECUTABLE $CTRL_CMDLINE" > /tmp/run_$NAME fi - $EXECUTABLE $CTRL_CMDLINE + else - $EXECUTABLE $CTRL_CMDLINE + echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SHARD_PATH/lib $EXECUTABLE $CTRL_CMDLINE" > /tmp/run_$NAME fi + schroot -p -c atys -- sh /tmp/run_$NAME #notify stop "$CWD/notify.sh" ServiceStopped $NAME