Scripts for core

Posted on 2011-05-10
Last Modified: 2012-08-14
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".

Question by:ratna1234
    1 Comment
    LVL 8

    Accepted 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

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Suggested Solutions

    Background Still having to process all these year-end "csv" files received from all these sources (including Government entities), sometimes we have the need to examine the contents due to data error, etc... As a "Unix" shop, our only readily …
    How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now