From c939e6a841cfe9e1e32586f5aee8f4dee8a24f5d Mon Sep 17 00:00:00 2001 From: Ciaby Date: Fri, 13 Mar 2015 16:11:27 -0600 Subject: [PATCH] Added monitor_rapi.sh to /home/rhizomatica/bin/ --- .../files/bin/monitor_rapi.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 modules/rhizomatica_base_system/files/bin/monitor_rapi.sh diff --git a/modules/rhizomatica_base_system/files/bin/monitor_rapi.sh b/modules/rhizomatica_base_system/files/bin/monitor_rapi.sh new file mode 100755 index 0000000..42541c2 --- /dev/null +++ b/modules/rhizomatica_base_system/files/bin/monitor_rapi.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +LOGFILE="/var/log/monitor_rapi.log" + +function logc() { + txt=$1 + echo "[`date '+%d-%m-%Y %H:%M:%S'`] $txt" >> $LOGFILE +} + +curl --connect-timeout 180 --max-time 180 -X GET http://localhost:8085/configuration/site 2>/dev/null +if [ $? -gt 0 ]; then + logc "RAPI is not responding kill the process" + PID=`ps axf | grep rapi | grep python | awk '{print $1}'` + kill -9 $PID + logc "RAPI restarted" +fi