if [[ -s "${SCRIPT_PATH}/alert.log" ]]; then
if test `cat alert.log | wc -l` -gt 4 ;
then
if test -s `cat alert.log | grep -i Time`;
then
cat alert.log | tail -r | grep -i Time > latest_time.out
CURRENT_TIMESTAMP=`cat latest_time.out | head -1 | grep "Time:*" | cut -f2 -d":"`
echo $CURRENT_TIMESTAMP
rm alert.log
fi
fi
else
CURRENT_TIMESTAMP=$( date +%Y-%m-%d )
echo $CURRENT_TIMESTAMP
fi
If i execute this script and if alert.log is not having the word time, it should print the current timestamp, but its not working. And when I checked separately, i found cat alert.log | wc -l` -gt 4, this part is not working.Can any one help
Aucun commentaire:
Enregistrer un commentaire