From 1dca3865097695dd9861ec3bc8e2c13993fe9cb8 Mon Sep 17 00:00:00 2001 From: Saravanakumar Arumugam Date: Wed, 17 Apr 2019 15:29:00 +0530 Subject: [PATCH] Log check_diskspace script's error into persistent storage Signed-off-by: Saravanakumar Arumugam --- CentOS/check_diskspace.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CentOS/check_diskspace.sh b/CentOS/check_diskspace.sh index 36aae78..92dc74f 100644 --- a/CentOS/check_diskspace.sh +++ b/CentOS/check_diskspace.sh @@ -1,5 +1,7 @@ #!/bin/bash +GLUSTERFS_LOG_CONT_DIR="/var/log/glusterfs/container" + # Disk full while true do @@ -8,10 +10,10 @@ do current_usage=$( df --output=pcent '/var/lib/glusterd' | tail -n1 | awk {'print $1'} ) max_usage=99% if [ "${current_usage%?}" -ge "${max_usage%?}" ]; then - echo "$(date) - $(basename $0): Running out of space in /var/lib/glusterd" - echo "$(date) - $(basename $0): Stopping glusterd" + echo "$(date) - $(basename $0): Running out of space in /var/lib/glusterd" >> $GLUSTERFS_LOG_CONT_DIR/check_diskspace + echo "$(date) - $(basename $0): Stopping glusterd" >> $GLUSTERFS_LOG_CONT_DIR/check_diskspace systemctl stop glusterd.service - echo "$(date) -$(basename $0): Stopped glusterd" + echo "$(date) -$(basename $0): Stopped glusterd" >> $GLUSTERFS_LOG_CONT_DIR/check_diskspace break fi done