add some error checking with exit codes

This commit is contained in:
Matthew Saunders Brown 2023-05-17 14:51:54 -07:00
parent 8cb1be03cb
commit b3cd92e8ff

View File

@ -25,9 +25,12 @@ vhost:getoptions "$@"
# check for domain (virtualhost) # check for domain (virtualhost)
if [[ -z $domain ]]; then if [[ -z $domain ]]; then
echo "domain is required" echo "domain is required"
exit exit 1
fi fi
if [[ -h /etc/apache2/sites-enabled/$domain.conf ]]; then if [[ -h /etc/apache2/sites-enabled/$domain.conf ]]; then
a2dissite --quiet $domain a2dissite --quiet $domain
else
echo "$domain is not enabled, nothing to do"
exit 1
fi fi