22 lines
547 B
Text
22 lines
547 B
Text
|
#!/bin/bash
|
||
|
if [ "${1: -5}" == ".conf" ]; then
|
||
|
export "extension="
|
||
|
else
|
||
|
export "extension=.conf"
|
||
|
fi
|
||
|
if [ ! -f "/etc/httpd/conf/sites-available/$1$extension" ]; then
|
||
|
echo ":: Error: Invalid site"
|
||
|
exit 2
|
||
|
fi
|
||
|
if [ -f "/etc/httpd/conf/sites-enabled/$1$extension" ]; then
|
||
|
echo ":: Error: Site already enabled"
|
||
|
exit 3
|
||
|
fi
|
||
|
echo ":: Enabling site"
|
||
|
ln -s "/etc/httpd/conf/sites-available/$1$extension" "/etc/httpd/conf/sites-enabled/$1$extension"
|
||
|
export "exitcode=$?"
|
||
|
if [ ! "$exitcode" == "0" ]; then
|
||
|
echo ":: Failed enabling site"
|
||
|
fi
|
||
|
exit $exitcode
|