Last active
February 6, 2022 11:14
-
-
Save edib/d277d5942b2ef077b434085903df0507 to your computer and use it in GitHub Desktop.
postgres logs compress script
This file contains 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 | |
echo "Job Started!" >> "log.compress.log" 2>&1 | |
echo `date` >> "log.compress.log" 2>&1 | |
find "/var/lib/pgsql/9.6/data/pg_log/" -type f -name "*.log" -mtime +1 | while read file ; do gzip -v $file >> "log.compress.log" 2>&1 ; done | |
echo `date` >> "log.compress.log" 2>&1 | |
echo "Job Finished!" >> "log.compress.log" 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment