Added a BASH Script (Crontab) to Check STEEM Container Running

in hive-102132 •  2 months ago 

I've running 5 steemd nodes - including two RPC nodes: api.justyy.com and api2.justyy.com

Sometimes the node crashed but I didn't notice for a long time. I then added a simple script that will be executed every 10 minutes in crontab.

#!/bin/bash

# Check if Docker is installed
if ! command -v docker &> /dev/null; then
  echo "Docker is not installed. Please install Docker to run this script."
  exit 2
fi

# check if steem container is running
container_name="steem"
exist=$(docker ps | grep $container_name | wc -l)
if [ "$exist" -eq 0 ]; then
  echo "$container_name container is not running."
  ## send email using php /var/www/mail.php
  msg="Steem container is not running on $(hostname) at $(date)."
  ### TO ADD: send email here.....
  exit 1
else
  echo "$container_name container is running."
  exit 0
fi

image.png

Steem to the Moon🚀!

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!