[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 223
  • Last Modified:

Scripts for core

I have the following line.

in one of the file.
APP is fine at :::::::::::::: 1.txt :::::::::::::: May 10 16:27:38

There is a Date and Time Stamp in the end as "May 10 16:27:38". Need a script to see if this time is more than 1 hr then raise an alert that "APP is not active since 1 hr".

0
ratna1234
Asked:
ratna1234
1 Solution
 
point_pleasantCommented:
core.txt is you file to check


NEWHOUR=`date +%H`
OLDHOUR=`cat ./core.txt | cut -f10 -d' '| cut -f1 -d':'`
DIFF=`echo $OLDHOUR $NEWHOUR| awk '{ print ($1-$2) }'`
if [ $DIFF -ne 0 ]
then
        echo "ALERT!! APP not active since 1 hour\n"
        #could send mail here or what ever the alert system is
fi
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now