Skip to content

Instantly share code, notes, and snippets.

@NickCrew
Last active June 19, 2023 00:32
Show Gist options
  • Save NickCrew/dbc5a93b6391648bf22459afb9be5457 to your computer and use it in GitHub Desktop.
Save NickCrew/dbc5a93b6391648bf22459afb9be5457 to your computer and use it in GitHub Desktop.
Check For Empty Site Configs
#!/bin/bash -e
ret=0
conf_dir=/etc/nginx/sites-enabled
files=($(find $conf_dir -type f -name "*.conf"))
for cf in "${files[@]}";
do
size=$(ls -alh "${cf}" | awk '{print $5}')
if [[ $size == "0" ]]; then
echo "EMPTY: $(basename $cf) (size: $size)"
ret=2
else
echo "OK: $(basename $cf) (size: $size)"
fi
done
exit $ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment