We're running a server program that keep adding message into a log file, and it's supposed to run 24/7. Is there any way that we can edit this log file or clean it up while it's still available for the server program. We are using script below in our cron script; however, the server loses the file pointer and won't be able to log the message right after this script is called. Is there any command to accomplish this in Unix?
Thank you.
mv $1 $1.$$
grep -v $2 $1.$$ >> $1
rm $1.$$
Thank you.
mv $1 $1.$$
grep -v $2 $1.$$ >> $1
rm $1.$$