Skip to content

Instantly share code, notes, and snippets.

@debility-zz
Created January 4, 2012 07:06
Show Gist options
  • Save debility-zz/1558897 to your computer and use it in GitHub Desktop.
Save debility-zz/1558897 to your computer and use it in GitHub Desktop.
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