I'm attempting to manage the size of a log file using tail.
I have a string called maxlog which is set to 30 ie
Then later in the code after checking if the log file length is over 30 lines I used the following bit of code to remove two of the oldest entries:
Code:
tail -n ${maxlog} - 2 /home/tim/Documents/$HOSTNAME/$HOSTNAME"_"ip.log > /tmp/templog.log && mv /tmp/templog.log /home/tim/Documents/$HOSTNAME/$HOSTNAME"_"ip.log
However it does not work. What is the correct syntax?
Many thanks for any help.
Tim