Last active
June 19, 2023 00:32
-
-
Save NickCrew/dbc5a93b6391648bf22459afb9be5457 to your computer and use it in GitHub Desktop.
Check For Empty Site Configs
This file contains hidden or 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 -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