I regularly use a2ensite
and a2dissite
to enable and disable sites in Apache. As far as I know it does little more than simply creating a symlink from /etc/apache2/sites-enabled
to /etc/apache2/sites-available
. I can also do it manually, but because it saves me typing a few characters I use these shortcuts.
I just did a cat /usr/sbin/a2ensite
, and to my surprise it's quite an elaborate program. According to the man pages, it does little more than enabling sites though. I briefly looked over the (Perl) source code, but even though it's a lot of code I don't really understand what it does more than simply creating a symlink.
Why does it need so much code to simply create a symlink? What am I missing here?
Actually
a2enconf
a2disconf
a2dismod
a2ensite
a2dissite
are all only symlinks to a2enmod
:
$ /usr/sbin$ ll -d a2*
lrwxrwxrwx 1 root root 7 Jul 15 17:33 a2disconf -> a2enmod
lrwxrwxrwx 1 root root 7 Jul 15 17:33 a2dismod -> a2enmod
lrwxrwxrwx 1 root root 7 Jul 15 17:33 a2dissite -> a2enmod
lrwxrwxrwx 1 root root 7 Jul 15 17:33 a2enconf -> a2enmod
-rwxr-xr-x 1 root root 15424 Apr 5 2016 a2enmod
lrwxrwxrwx 1 root root 7 Jul 15 17:33 a2ensite -> a2enmod
-rwxr-xr-x 1 root root 9870 Jul 15 17:33 a2query
and a2enmod
implements the functionality of all six of them in one script.
It decides what to do depending on $0
(i.e. the name the script was called with).
That's probably the reason why it's more complicated than a simple ln -s
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With