Planning tasks

crontab -e 

*/1 * * * *  sudo sh /root/redis/redis_cluster/7003-cron.sh

Script

#!/bin/sh

redis=`netstat -an | grep ":7003" | awk '$1 == "tcp" && $NF == "LISTEN" {print $0}' | wc -l`

if [ $redis -eq 0 ];then
      # If the port is occupied, perform the following 
      sudo  /root/redis/redis_cluster/start_all.sh.sh
  else
      # The port occupied prompt is as follows 
          echo " Running normally !"
fi

The startup script

cd /root/redis/redis_cluster/7000
/usr/local/bin/redis-server redis.conf
cd /root/redis/redis_cluster/7001
/usr/local/bin/redis-server redis.conf
cd /root/redis/redis_cluster/7005
/usr/local/bin/redis-server redis.conf