I have the following script running every 3 minutes with cron:
#!/bin/bash cd ~/Documents/Fetch/ wget remotehost/data.txt --output-document=tmp cp tmp data.txt rm tmp
To fetch a self-generated php log.
I want to check if any changes have been made to the file (with a 3 minute timespan). So in a terminal on my second screen, i'm running
tail -f ~/Documents/Fetch/
Now, if no changes are made to the data.txt file, tail just outputs the same log over and over again, separated by
tail: /home/midas/Documents/Fetch/data.txt: file truncated.
is there a way to tell
tail to completely
clear the terminal screen before showing the output when the file is truncated?
I basically want this to happen:
- tail prints initial content
- tail notices the file is truncated >
- tail prints the content it sees after truncation of the file.
man tail page did not seem to give me this option.
Does anyone have experience with this?
I know it kinda beats the purpose of tail itself, but I can imagine a few situations where this would be handy.