SoFunction
Updated on 2025-03-09

A script that combines shell for loop and case (monitoring program status)

if [ $count -eq 0 ]; then
  case $myhost in
  nginx)
  cd /usr/local/webserver/nginx/sbin/
  ./nginx
  echo "nginx has be down"
  sleep 5

  mysql)
  /etc//mysqld start
  echo "mysql has be down"

  *)
  echo "what‘s the hell?"

esac
  fi
done
set +x