Quantcast
Channel: THWACK: All Content - Server & Application Monitor
Viewing all articles
Browse latest Browse all 12281

How can I monitor a file size change on a Linux Box

$
0
0

Hello,

I need to check files if more than xx minutes to trigger an action however this is not being picked up by Solarwinds with the script i have created on my Linux Server but when i log on to the Linux Serverer I can run the script manually.

Below is the script I wrote

 

# script to find last modified and last accessed time of a file

E_NOARG=65

E_MOREARG=66

if [  $# = 0 ]

then

        echo -e '\E[31m' "Usage: $0 <filename>"

        tput sgr0

        exit $E_NOARG

elif [ $# -gt 1 ]

then

        echo -e '\E[31m' "Please give only one file at a time"

        tput sgr0

        exit $E_MOREARG

fi

LS=`which ls`

MOD_TIME=`$LS -lart $1|cut -f6,7,8 -d" "`

ACC_TIME=`$LS -laru $1|cut -f6,7,8 -d" "`

echo "The modified time of the file is $MOD_TIME"

echo "The accessed time of the file is $ACC_TIME"

 

Many thanks


Viewing all articles
Browse latest Browse all 12281

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>