Last active
August 29, 2015 14:21
-
-
Save tkuchiki/1ed58181127c8107b0b0 to your computer and use it in GitHub Desktop.
apache の Directory ディレクティブの重複しているパスを出力する
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
grep -h -r '<Directory' /path/to/httpd/vhost/conf/dir | sed -e 's/"//g' | sed -e 's/<Directory \(.*\)>/\1/' | sed -e 's/ *//g' | sed -e 's/\/$//' | sort | uniq -c | awk 'BEGIN { status=0 } { if ($1 > 1) { print $2; status=1} } END { exit status }' |
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
configtest) | |
$apachectl -t | |
DIR_PATHS=$(grep -h -r '<Directory' /path/to/httpd/vhost/conf/dir | sed -e 's/"//g' | sed -e 's/<Directory \(.*\)>/\1/' | sed -e 's/ *//g' | sed -e 's/\/$//' | sort | uniq -c | awk 'BEGIN { status=0 } { if ($1 > 1) { print $2; status=1} } END { exit status }') | |
RETVAL=$? | |
if [ $RETVAL -ne 0 ]; then | |
echo "Duplicate Directory directive" | |
echo && echo $DIR_PATHS | |
fi | |
;; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment