Skip to content

Instantly share code, notes, and snippets.

@aminamid
Created October 26, 2015 06:16
Show Gist options
  • Save aminamid/5722a38b8cf29246edec to your computer and use it in GitHub Desktop.
Save aminamid/5722a38b8cf29246edec to your computer and use it in GitHub Desktop.
RG zipper
#!/bin/bash
while true
#do fuser -a smtp*.log 2>&1 | sed -n -e 's/^\(smtp.*.log\): *$/\1/p' | xargs -i gzip {}
do LANG=C date
for f in $(ls *\.log);do echo ${f%-*} ; done | for f in $(cat /dev/stdin); do echo ${f%-*}; done | uniq | for prefix in $(cat /dev/stdin); do ls -t ${prefix}*\.log | tail -n+3 ;done | xargs -i gzip {}
sleep 600
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment