Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
apache config converter v0.1.1
#!/bin/sh
CONFIG_FILE="/etc/httpd/conf/httpd.conf"
DATE=`date '+%Y%m%d'`
if [ -f "${CONFIG_FILE}.orig.${DATE}" ]; then
echo '(maybe)apache config file is already converted. :-P'
exit
fi
cp $CONFIG_FILE ${CONFIG_FILE}.orig.${DATE}
sed \
-e '/^Alias\s\/icons/s/^/#/' \
-e '/^Alias\s\/error/s/^/#/' \
-e '/^ScriptAlias\s\/cgi-bin/s/^/#/' \
-e '/<Directory "\/var\/www\/icons">/,/<\/Directory>/s/^/#/' \
-e '/<Directory "\/var\/www\/cgi-bin">/,/<\/Directory>/s/^/#/' \
-e '/<Directory "\/var\/www\/error">/,/<\/Directory>/s/^/#/' \
${CONFIG_FILE} > ${CONFIG_FILE}.edit
mv -f ${CONFIG_FILE}.edit ${CONFIG_FILE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.