Created
December 25, 2010 19:31
-
-
Save marcw/755014 to your computer and use it in GitHub Desktop.
List vhost available on your machine and render it as an HTML5 document
This file contains 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 | |
# Config | |
DIR="/opt/local/apache2/conf/sites-enabled" | |
# View | |
TITLE="local vhosts" | |
H1="vhosts on $HOSTNAME" | |
HEADER="<!DOCTYPE html>\n<html><head><title>$TITLE</title></head><body><h1>$H1</h1><ul>\n" | |
FOOTER="</ul><p>Generated at <time>`date +"%Y-%m-%d %H:%M"`</time></p></body></html>" | |
echo -e $HEADER | |
find $DIR -type l | xargs -L 1 \ | |
awk '/ServerName/ {print "<li><a target=\"_blank\" href=\"http://"$2"\">"$2"</a></li>"}' | |
echo -e $FOOTER |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment