Created
July 13, 2018 01:06
-
-
Save simbalinux/c7591e2c45c16353adba6d69baf9c1d7 to your computer and use it in GitHub Desktop.
When logs cannot be truncated on a NAS and you need to pipe logs files and rotate forcefully
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## non ssl | |
exec >> "/var/www/vhosts/application/log/archive/test_ops/devel.domain.com_$(date +%Y-%m-%d).log"; | |
while IFS= read -r line; do | |
if (( SECONDS > 10 )); then | |
exec >> "/var/www/vhosts/application/log/archive/test_ops/devel.domain.com_$(date +%Y-%m-%d).log" | |
SECONDS=0 | |
fi | |
printf '%s\n' "$line"; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment