Use truncate --no-create --size=0 to truncate files

This avoids the permission error due to /proc/sys/fs/protected_regular = 2
setting which is now enabled by default in bullseye.
This commit is contained in:
Raphaël Hertzog 2020-09-25 11:47:38 +02:00
parent d2bc6e278d
commit c3968cf1c6
No known key found for this signature in database
GPG Key ID: 03881DABEBC29AB9
1 changed files with 1 additions and 1 deletions

View File

@ -5,5 +5,5 @@ set -e
# Truncate log files
for _FILE in $(find /var/log/ -type f)
do
: > ${_FILE}
truncate --no-create --size=0 ${_FILE}
done