HEX
Server: LiteSpeed
System: Linux CentOS-79-64-minimal 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: vishn3436 (5293)
PHP: 8.0.15
Disabled: NONE
Upload Files
File: //scripts/checkGeometra4ProdWarn.sh.bak
#!/bin/bash

PROJECT_DIR="/data/geometra-4-server-prod"
Warning_LIST="$PROJECT_DIR/WarningInstance.list"
LOG="$PROJECT_DIR/logs/autoHealWarningInstance.log"

cd $PROJECT_DIR
/root/.ebcli-virtual-env/executables/eb health | grep Warning | grep "i-" | awk '{print $1}'> $Warning_LIST

if [ -s $Warning_LIST ]
then
    cat $Warning_LIST | while read INSTANCE
	do
		echo "$(date) | Rebooting Warn Instance: $INSTANCE" >> $LOG
#		/usr/local/bin/aws ec2 reboot-instances --instance-ids $INSTANCE
		curl --location --request POST 'https://marketing.wp.karmanye.in/api/Karmanye/send-message'  --header 'Content-Type: application/json; charset=utf-8'  --header 'Accept: application/json'  --header 'Authorization: Bearer $2b$10$f7yAQHm3Y1eOxs92aiEJ9eohJ0AdUQ2YwXxUARzk3sVLgKIVw0k2q' -d '{ "phone": "919033595842", "message": "*Geometra-4-Server-Prod Warning Instance: '"$INSTANCE"'* \n\n*Rebooting Instance for AutoHealing*"}'
	done
else
     echo "$(date) | Everything OK!" 
     eb ssh -n 1 --command "sudo ps -aux | grep npm"
fi