top of page

PUBLISHING MONITOR


################################################################ # # Program : check.linux.publishing.sh # : Fredrick Were # : Oct 2018 # #################################################################

fgGreen=$(tput setaf 2) # green fgRed=$(tput setaf 1) # red fgYellow=$(tput setaf 3) # yellow blue=$(tput setaf 4) #blue normal=$(tput sgr0) #normal #------------------------------------------------------------ SCR=`basename $0` LINEOUT="/tmp/workstation/qa.lineout" #-------------------------------------------------------------------- #!/bin/bash SCR=`basename $0` LINEOUT="/app/documentum/fwerescripts/systemhealth/qa.lineout" #------------------------------------------------------------------------------------- PDIR="/app/documentum/dmadmin/admin/publishing" if [ -d "$PDIR" ] then echo "$PDIR directory exists!" 2>&1 >/dev/null; else echo "$PDIR directory not found!" 2>&1 >/dev/null; status="INFO" msg1="NOT Publishing SERVER: Manually Validate to be sure [[Pub status=Uknown]]" msg="$(printf "%40s" "${fgYellow} $msg1${normal}")" REPORT="$( $LINEOUT "$status $SCR $msg" | sed '/^\s*$/d')" printf "%s\n" "$REPORT" exit 1; fi

cd "$PDIR" && \

if [ "$PWD" == "$PDIR" ]; then echo "right dir" 2>&1 >/dev/null; else echo "Sorry! Error!" 2>&1 >/dev/null; status="ERROR" msg1="Unable to change server directory forPublishing. manually validate the missing dir." msg="$(printf "%40s" "${fgRed} $msg1${normal}")" REPORT="$( $LINEOUT "$status $SCR $msg" | sed '/^\s*$/d')" printf "%s\n" "$REPORT"; exit 1; fi

FILE1="PUBDB_report_generator.sh" FILE2="publishing_monitoring.sh" FILE3="/tmp/publishing.txt"

echo "Testing File1" 2>&1 >/dev/null; if [[ -f "$FILE1" ]]; then echo "File exist" 2>&1 >/dev/null; ./$FILE1 >/dev/null; sleep 5; else echo "Sorry ! File Missing!" 2>&1 >/dev/null; status="INFO" msg1="NOT Publishing server: Manually Validate" msg="$(printf "%40s" "${fgYellow} $msg1${normal}")" REPORT="$( $LINEOUT "$status $SCR $msg" | sed '/^\s*$/d')" printf "%s\n" "$REPORT" exit 1; fi

echo "Testing File2" 2>&1 >/dev/null; if [[ -f "$FILE2" ]]; then echo "File exist" 2>&1 >/dev/null; ./$FILE2 >/dev/null; sleep 5; else echo "Sorry ! File Missing!" 2>&1 >/dev/null; status="WARN" msg1="Publishing File Missing: Server might NOT have publishing Manually Validate" msg="$(printf "%40s" "${fgYellow} $msg1${normal}")" REPORT="$( $LINEOUT "$status $SCR $msg" | sed '/^\s*$/d')" printf "%s\n" "$REPORT" exit 1; fi

echo "Testing File3" 2>&1 >/dev/null; if [[ -f "$FILE3" ]]; then echo "File exist" 2>&1 >/dev/null; result="$(cat /tmp/publishing.txt |sort|uniq | awk '{print $5}')" echo $result if [ $result == OK ]; then echo "Yess" 2>&1 >/dev/null; status="OK" msg1="Publishing RUNNING SUCCESSFULLY: publishing=HEALTHY" msg="$(printf "%40s" "${fgGreen} $msg1${normal}")" REPORT="$( $LINEOUT "$status $SCR $msg" | sed '/^\s*$/d')" printf "%s\n" "$REPORT" else echo "Noo" 2>&1 >/dev/null; status="FAIL" msg1="Publishing NOT Responding: Condition=UN_HEALTHY" msg="$(printf "%40s" "${fgRed} $msg1${normal}")" REPORT="$( $LINEOUT "$status $SCR $msg" | sed '/^\s*$/d')" printf "%s\n" "$REPORT" fi else echo "Sorry ! File Missing!" 2>&1 >/dev/null; status="ERROR" msg1="Publishing status UKNOWN: Condition=UN_HEALTHY" msg="$(printf "%40s" "${fgRed} $msg1${normal}")" REPORT="$( $LINEOUT "$status $SCR $msg" | sed '/^\s*$/d')" printf "%s\n" "$REPORT" fi

bottom of page