#!/bin/sh -e # ----------------------------------------------------------------- # # # # Disables a configuration file for Apache2 Web server # # # # Author : Jonathan Dray # # Version : 1.0 # # Date : 2008.03.14 # # License : lgpl # # Usage : a2disconf [configuration file name] # # # # ----------------------------------------------------------------- # SYSCONFDIR='/etc/apache2' if [ -z $1 ]; then echo "Which configuration file would you like to disable?" echo -n "Your choices are: " ls /etc/apache2/conf-enabled/* | \ sed -e "s,$SYSCONFDIR/conf-enabled/,,g" | xargs echo echo -n "Configuration file name? " read CONFNAME else CONFNAME=$1 fi if [ $CONFNAME = "default" ]; then PRIORITY="000" fi if ! [ -e $SYSCONFDIR/conf-enabled/$CONFNAME -o \ -e $SYSCONFDIR/conf-enabled/"$PRIORITY"-"$CONFNAME" ]; then if [ -e $SYSCONFDIR/conf-available/$CONFNAME ]; then echo "Configuration file $CONFNAME is already disabled" exit 0 fi echo "Configuration file $CONFNAME does not exist!" >&2 exit 1 fi if ! rm $SYSCONFDIR/conf-enabled/$CONFNAME 2>/dev/null; then rm -f $SYSCONFDIR/conf-enabled/"$PRIORITY"-"$CONFNAME" fi echo "Configuration file $CONFNAME disabled; run /etc/init.d/apache2 reload to fully disable."