Created
July 27, 2016 06:37
-
-
Save cstenac/34105cc04dcb35da5fb51e84369068da to your computer and use it in GitHub Desktop.
Automatic restart of DSS if get-configuration call times out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
RESTART_SCRIPT=/path/to/dssrestart.sh | |
STACKS_BACKUP_DIR=/path/to/dir | |
DSS_URL=http://localhost:32000 | |
MAX_TIME=600 # 10 minutes timeout | |
curl -s -m $MAX_TIME $DSS_URL/dip/api/get-configuration > /dev/null | |
RETCODE=$? | |
if [ $RETCODE = 28 ] | |
then | |
echo "Failed to ping DSS (timed out after $MAX_TIME seconds), forcing a restart" | |
# First, get the stacks (also impose a timeout here) | |
NOW=`date +%Y%m%d-%H%M%S` | |
curl -m $MAX_TIME $DSS_URL/dip/api/internal/debug/dump-stacks > $STACKS_BACKUP_DIR/hang-stacks-$NOW.txt | |
$RESTART_SCRIPT | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment