Sponsored Content
Top Forums Shell Programming and Scripting Alert log not update every time. Post 302503442 by ooilinlove on Thursday 10th of March 2011 02:22:29 PM
Old 03-10-2011
Alert log not update every time.

My Script . This check log file size every 1 minute.

Code:
#! /bin/bash


logFiles="log1.log log2.log"
logLocation="/usr/home/test/log/"
sleepTime=60


failMessage=":: Log not running :: Pls Check Service"
successMessage="OK"

arr=($logFiles)

arrlen=${#arr[@]}
arrcount=()

date
for ((count=0; count<arrlen; count++)) ; do
    arrcount[$count]=`ls -l  $logLocation${arr[$count]}  |awk '{print $5}'`
    echo "${arr[$count]} Original size :: ${arrcount[$count]}"
done
echo

while [ "e" == "e" ] ; do 
    sleep $sleepTime
    date
    for ((count=0; count<arrlen; count++)) ; do
        nc=`ls -l  $logLocation${arr[$count]}  |awk '{print $5}'`
        echo -n "${arr[$count]} "
        if [ $nc == ${arrcount[$count]} ] ; then
            echo $failMessage
        else
            arrcount[$count]=$nc
            echo $successMessage
        fi
    done
    echo
done

Ex. out put my script.
Code:
Fri Mar 11 02:09:28 ICT 2011
log1.log Original size :: 262311887
log2.log Original size :: 236930257

Fri Mar 11 02:10:28 ICT 2011
log1.log  OK
log2.log  OK

Ex. If. log2.log not update
Code:
Fri Mar 11 02:12:28 ICT 2011
log1.log  OK
log2.log  :: Log not running :: Pls Check Service

I want out put.
Code:
If. log2.log not update

Fri Mar 11 02:14:28 ICT 2011
log1.log OK
log2.log not update file size.

Fri Mar 11 02:15:28 ICT 2011
log1.log OK
log2.log not update file size 1 minute.

Fri Mar 11 02:16:28 ICT 2011
 log1.log OK
 log2.log not update file size 2 minute.

Fri Mar 11 02:17:28 ICT 2011
 log1.log OK
 log2.log not update file size 3 minute.
.
.
.
.
.
.
Fri Mar 11 02:37:28 ICT 2011
  log1.log OK
  log2.log not update file size 33 minute.


Please help to write this script.

Regards
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

compare update time of files

Hi, does anyone know of a way to compare files update time (not only days - also hours and minutes) (command? scripts? perl scripts?) Dori (8 Replies)
Discussion started by: dorilevy
8 Replies

2. Shell Programming and Scripting

To simultaneously update password change in two server at a time

I am new beginner in Unix and little experienced in BaaN ERP. Problem Statement: I have to run a BaaN session. I have to change the password for both primary and secondary server by using this session. On primary server only few people has access permission (say 10). But on secondary server... (0 Replies)
Discussion started by: s_chandrakar
0 Replies

3. Shell Programming and Scripting

shell script not getting current error messages with time from alert.log

Hi All, I need to get current error messages with time from alert.log.Below is my shell script but it's not working to meet this objective. could anyone pls share on the above issue for resolution: #################################################################### ## ckalertlog.sh ##... (2 Replies)
Discussion started by: a1_win
2 Replies

4. Shell Programming and Scripting

how to write a shellscript to send a mail alert to the website user based on license expiration time

hi, i am very much new to shell scripting i have a requirement that i have to develop a License Renewal Alert system that has to give a alert mail to the users before 30days of user account expiration, by checking expiration date of the user with the data base, this system will... (0 Replies)
Discussion started by: deepu_Shscripts
0 Replies

5. Shell Programming and Scripting

help with script Alert log not update every time.

:p Hello :) This is my script . This check log file size every 1 minute. Credit code https://www.unix.com/shell-programming-scripting/151723-help-writing-script-check-log-not-update.html #! /bin/bash logFiles="log1.log log2.log" logLocation="/usr/home/test/log/" sleepTime=60 ... (8 Replies)
Discussion started by: ooilinlove
8 Replies

6. UNIX for Advanced & Expert Users

Update users password change time

Hello - Is this possible on Unix machines? Can we update user password change time? (6 Replies)
Discussion started by: manju--
6 Replies

7. Shell Programming and Scripting

Check log file size every 10 minute. Alert if log not update

How to check log size every 10min. by script (can use crontab) if log size not change with alert "Log not update" Base run on SunOS 5.8 Generic_Virtual sun4u sparc SUNW,SPARC-Enterprise logFiles="log1.log log2.log" logLocation="/usr/home/test/log/" Out put. Tue Jan 31... (3 Replies)
Discussion started by: ooilinlove
3 Replies

8. UNIX for Dummies Questions & Answers

Does 'grep' update a file's access date/time?

I've got a job that finds and removes trace files based upon an access time of more than seven days (I've also tried a modify date). find TABC* -atime +7 -exec rm + find TABC* -mtime +7 -exec rm + Whether I use -atime or -mtime, the process seems to work sporadically. Sometimes it removes... (6 Replies)
Discussion started by: Scottie1954
6 Replies

9. Shell Programming and Scripting

Update time stamp and replace values

Can anyone please assist? I need to grab each line between the lines "HEADER" and "TRAILER" Each line contains two timestamps(Timestamp1) and (Timestamp2). I need to create two variables TIME_SUBSTRCT and TIME_ADD and then recalculate the two timestamps using this logic:... (5 Replies)
Discussion started by: vinus
5 Replies
LOG(3)							   BSD Library Functions Manual 						    LOG(3)

NAME
log, log2, log10, log1p, -- logarithm functions SYNOPSIS
#include <math.h> double log(double x); double log2(double x); double log10(double x); double log1p(double x); DESCRIPTION
The log() function computes the value of the natural logarithm of argument x. The log2() function computes the value of the logarithm of argument x to base 2. The log10() function computes the value of the logarithm of argument x to base 10. The log1p() function computes the value of log(1+x) accurately even for very small values of x. SPECIAL VALUES
log(+-0) , log2(+-0) , and log10(+-0) return -infinity and raise the "divide-by-zero" floating-point exception. log(1) , log2(1) , and log10(1) return +0. log(x) , log2(x) , and log10(x) return a NaN and raise the "invalid" floating-point exception for x < 0. log(+infinity) , log2(+infinity) , and log10(+infinity) return +infinity. log1p(+-0) returns +-0. log1p(-1) returns -infinity and raises the "divide-by-zero" floating-point exception. log1p(x) returns a NaN and raises the "invalid" floating-point exception for x < -1. log1p(+infinity) returns +infinity. SEE ALSO
math(3), exp(3), exp2(3), expm1(3), pow(3), infnan(3) STANDARDS
The log() , log2() , log10() , and log1p() functions conform to ISO/IEC 9899:1999(E). 4th Berkeley Distribution July 2, 2003 4th Berkeley Distribution
All times are GMT -4. The time now is 09:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy