Article 5RZNA line numbers are not sent to custom log file.

line numbers are not sent to custom log file.

by
linuxgirl94
from LinuxQuestions.org on (#5RZNA)
Hello!

I am making a bash script, that will serve as a daemon. What i need to do is to send a line number,timestamp, and a message whenever another file (testfile) has been changed or modified to my custom log file.

The problem is that the line numbers are not showing up in the log file along with the timestamp and the change message.

my script right now:

Code:#!/bin/bash

LTIME=`stat -c %y /var/testfil1`

while true
do
ATIME=`stat -c %y /var/testfil1`

if [[ "$ATIME" != "$LTIME" ]]
then
j=1
for i in `cat /var/testfil1`
do
j=$((j+1))
echo "$j" `date` : "Andringar har gjorts.">>/var/log/loggfil;
done
LTIME=$ATIME
fi
let j+=1
sleep 10
donelatest?d=yIl2AUoC8zA latest?i=fRnl-t_DG34:lFcuEmgNhi8:F7zBnMy latest?i=fRnl-t_DG34:lFcuEmgNhi8:V_sGLiP latest?d=qj6IDK7rITs latest?i=fRnl-t_DG34:lFcuEmgNhi8:gIN9vFw
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments