File: a2dissite

package info (click to toggle)
apache2 2.2.3-4%2Betch11
  • links: PTS
  • area: main
  • in suites: etch
  • size: 35,160 kB
  • ctags: 19,065
  • sloc: ansic: 206,618; sh: 18,457; perl: 1,649; makefile: 1,103; awk: 874; pascal: 490; python: 308; lex: 191; yacc: 100
file content (29 lines) | stat: -rw-r--r-- 742 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh -e

SYSCONFDIR='/etc/apache2'

if [ -z $1 ]; then
	echo "Which site would you like to disable?"
	echo -n "Your choices are: "
	ls /etc/apache2/sites-enabled/* | \
	sed -e "s,$SYSCONFDIR/sites-enabled/,,g" | xargs echo
	echo -n "Site name? "
	read SITENAME
else
	SITENAME=$1
fi

if [ $SITENAME = "default" ]; then
        PRIORITY="000"
fi

if ! [ -e $SYSCONFDIR/sites-enabled/$SITENAME -o \
       -e $SYSCONFDIR/sites-enabled/"$PRIORITY"-"$SITENAME" ]; then
	echo "This site is already disabled, or does not exist!"
	exit 1
fi

if ! rm $SYSCONFDIR/sites-enabled/$SITENAME 2>/dev/null; then
	rm -f $SYSCONFDIR/sites-enabled/"$PRIORITY"-"$SITENAME"
fi
echo "Site $SITENAME disabled; run /etc/init.d/apache2 reload to fully disable."