Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly run restartComponent.sh avoiding hardwired paths #12185

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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" [email protected]
fi
Expand Down