openSuse: Apache modules management from shell

To manage Apache Httpd on openSuse we have the classic command a2enmod, shared with many other distros, which allows to: 1) know if a module is enabled, 2) enable a module and 3) disable a module.

To extend what already present in a2enmod i have written a simple wrapper to a2enmod in order to have mote functionalities: 1) get the list of every module available on the system, 2) get the list of every module enabled, 3) check if a module has been enabled or not, 4) enable one or more modules and 5) disable one or more module.

To be able to use this tool by yourself create file /usr/local/bin/apache2mods.sh, make it executable and inside it copy & paste what follows:

At this point you will be able to call

  • apache2mods.sh all : get the list of every module available
  • apache2mods.sh all-enabled : get the list of every module enabled
  • apache2mods.sh enabled <module> : check if the module has been enabled
  • apache2mods.sh enable <module> [<module> … <module>] : enable the module, or the modules, specified in the parameters’ list
  • apache2mods.sh disable <module> [ <module> … <module>] : disable the module, or the modules, specified in the parameters’ list

Leave a comment