soscmd/a2ensite

22 lines
547 B
Text
Raw Normal View History

2023-07-17 05:27:43 +02:00
#!/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