soscmd/a2dissite

22 lines
465 B
Text
Raw Normal View History

2023-07-17 05:27:43 +02:00
#!/bin/bash
if [ "$1" == "" ]; then
echo ":: Error: Invalid site"
exit 1
fi
if [ "${1: -5}" == ".conf" ]; then
export "extension="
else
export "extension=.conf"
fi
if [ ! -f "/etc/httpd/conf/sites-enabled/$1$extension" ]; then
echo ":: Error: Site already disabled"
exit 3
fi
echo ":: Disabling site"
rm -rf "/etc/httpd/conf/sites-enabled/$1$extension"
export "exitcode=$?"
if [ ! "$exitcode" == "0" ]; then
echo ":: Failed disabling site"
fi
exit $exitcode