Is my file updated or not | Check with linux script | Linux in Pakistan
Shell Script

Is my file updated or not | Check with linux script

Need script to to check the my file is getting updated or not.

So if you want a script which check that your file is updated or not below is a simple script.

#! /bin/bash
ls -ltr /home/net/file21.txt | awk ‘{print $6,$7}’ | while read i
do
Current_Date=$(date ‘+%b %d’)
echo $Current_Date
if [[ “$Current_Date” == “$i” ]] ; then
echo “Files Updated ”
exit 0
else
echo “Log files are not updated please check”
exit 0
fi
done