#!/bin/sh 
# Script for ping validation
# Copyright (C) Cypress Solutions Inc. 2022. All rights reserved.

# Check number of arguments
if [ $# -ne 2 ]
then
  exit $?
fi

HOST=$1
COUNT=$2

# Ping the server COUNT times
ping -c $COUNT -s 0 -W 5 -q $HOST &> /dev/null

# set ping fail flag
if [ $? -ne 0 ]; then
  echo 1 > /var/volatile/ctm/PINGFAIL
fi
