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

  • 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".

1 Solution
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 ]
        echo "ALERT!! APP not active since 1 hour\n"
        #could send mail here or what ever the alert system is

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