I am using linux and doing some bash scripting. I have a log file which is making logs of all the events/changes our in particular directory. I need to copy these logs to some other file so that I can work on it. But I cannot just use:
cp /mnt/abc.log /tmp/xyz.log
Because it will not delete the logs which are already copied from
abc.log - I need to copy the logs and then delete the copied logs (not the file) so that next time I will get new logs.
Because If I will copy the logs the delete that file and again recreate the file then I will loss the events occurred in the mean time. I need some bash script for this.