Unlock a logfile locked by another process linux
How can I unlock this file so that my script can nullify the logfile everyday at a given time.
Stop turnserver before you do
sudo cp /dev/null /var/log/turn.log
sudo truncate -s 0 /var/log
and start it after this is done. If supported only a restart after emptying the file is also possible. I would have used > /var/log/turn.log
as root or from crontab as root; but this also keeps the file as is until released. Truncate is not needed.
Besides altering turnsever to not lock the file all the time (using a service I would lock the file when needed and somewhere in the loop close/reopen the log) the more generic method would be to add the log to logrotate and have logrotate deal with this: compress the file and remove compressed files when older than x days. Those older logs are never touched by turnserver.