Skip to content

Instantly share code, notes, and snippets.

@tfheen
Created October 13, 2014 09:34
Show Gist options
  • Select an option

  • Save tfheen/22deaa97a2105f59fd2a to your computer and use it in GitHub Desktop.

Select an option

Save tfheen/22deaa97a2105f59fd2a to your computer and use it in GitHub Desktop.
#!/bin/sh
TMPFILE=$(mktemp --tmpdir logrotate.XXXXXXXXXX)
cleanup() {
rm -f $TMPFILE
}
trap cleanup EXIT
test -x /usr/sbin/logrotate || exit 0
/usr/sbin/logrotate -v /etc/logrotate.conf > $TMPFILE 2>&1
if grep -qs "gzip: stdin" $TMPFILE; then
cat $TMPFILE
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment