Skip to content

Commit

Permalink
Properly run restartComponent.sh avoiding hardwired paths
Browse files Browse the repository at this point in the history
  • Loading branch information
todor-ivanov committed Nov 27, 2024
1 parent 90a14e5 commit 83c08ff
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions deploy/restartComponent.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
### Script to check the tail of each WMAgent component and evaluate
# whether they are running or not, based on file meta-data (stat).
# Component is automatically restarted if deemed down.
Expand All @@ -10,15 +10,12 @@ HOST=$(hostname)
DATENOW=$(date +%s)
DEST_NAME=cms-wmcore-team

# Figure whether it's a python2 or python3 agent
if [ ! -d "$install" ]; then
install="/data/srv/wmagent/current/install/"
fi
[[ -z $WMA_INSTALL_DIR ]] && { echo "ERROR: Trying to run without having the full WMAgent environment set!"; exit 1 ;}

echo -e "\n###Checking agent logs at: $(date)"
comps=$(ls $install)
comps=$(ls $WMA_INSTALL_DIR)
for comp in $comps; do
COMPLOG=$install/$comp/ComponentLog
COMPLOG=$WMA_INSTALL_DIR/$comp/ComponentLog
if [ ! -f $COMPLOG ]; then
echo "Not a component or $COMPLOG does not exist"
continue
Expand All @@ -34,7 +31,8 @@ for comp in $comps; do
fi

TAIL_LOG=$(tail -n100 $COMPLOG)
$manage execute-agent wmcoreD --restart --components=$comp
echo -e "Restarting component: $comp"
manage execute-agent wmcoreD --restart --components=$comp
echo -e "ComponentLog quiet for $INTERVAL secs\n\nTail of the log is:\n$TAIL_LOG" |
mail -s "$HOST : $comp restarted" $DEST_NAME@cern.ch
fi
Expand Down

0 comments on commit 83c08ff

Please sign in to comment.