Skip to content

Instantly share code, notes, and snippets.

@prochor666
Last active August 10, 2021 14:05
Show Gist options
  • Save prochor666/060faa1ff91209887972c2a7e4b9e690 to your computer and use it in GitHub Desktop.
Save prochor666/060faa1ff91209887972c2a7e4b9e690 to your computer and use it in GitHub Desktop.
Found specific logrotate directive in /etc/logrotate.d/nginx
#!/bin/bash
# @author prochor666@gmail.com
# Grep /etc/logrotate.d/nginx file for given string
function isPresent()
{
if [[ -z "$(grep -i "${@}" /etc/logrotate.d/nginx)" ]];
then
echo "ERROR: ${@} not found"
else
echo "SUCCESS: ${@} found"
fi
}
echo "Grep /etc/logrotate.d/nginx file for given string"
echo ""
isPresent "Bla/bla/bla/bla.log"
isPresent "/var/www/\*/log\/access.log"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment