Add a2{en,dis}site commands
This commit is contained in:
parent
29f1c461f2
commit
e067bd0b98
2 changed files with 42 additions and 0 deletions
21
a2dissite
Executable file
21
a2dissite
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/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
|
21
a2ensite
Executable file
21
a2ensite
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/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
|
Loading…
Reference in a new issue