diff options
author | Andrew Cady <d@jerkface.net> | 2020-09-04 20:31:23 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2020-09-04 20:31:23 -0400 |
commit | d0ee3530a5f58d9984e20dd723fe2a927ac7c3cf (patch) | |
tree | 5f134ea8ecb430b752dc299bbe27a27641b6be24 | |
parent | 3f06d0738237a57062bf6d903e7859af99441e82 (diff) |
only restart apache if modules changed
-rw-r--r-- | selfpublish.sh | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/selfpublish.sh b/selfpublish.sh index bdeb086..9b263e4 100644 --- a/selfpublish.sh +++ b/selfpublish.sh | |||
@@ -128,10 +128,20 @@ get_dyndns_domain() | |||
128 | 128 | ||
129 | enable_apache_modules() | 129 | enable_apache_modules() |
130 | { | 130 | { |
131 | local restart= | ||
131 | for MODULE in $APACHE_MODULES | 132 | for MODULE in $APACHE_MODULES |
132 | do | 133 | do |
133 | a2enmod $MODULE >/dev/null | 134 | if ! [ -e /etc/apache2/mods-enabled/$MODULE.load ] && |
135 | ! [ "$MODULE" = cgi -a -e /etc/apache2/mods-enabled/cgid.load ] | ||
136 | then | ||
137 | a2enmod $MODULE >/dev/null | ||
138 | restart=y | ||
139 | fi | ||
134 | done | 140 | done |
141 | if [ "$restart" ] | ||
142 | then | ||
143 | systemctl restart apache2 | ||
144 | fi | ||
135 | } | 145 | } |
136 | 146 | ||
137 | site_conf_template() | 147 | site_conf_template() |
@@ -284,7 +294,6 @@ then | |||
284 | systemctl reload apache2 || systemctl restart apache2 | 294 | systemctl reload apache2 || systemctl restart apache2 |
285 | else | 295 | else |
286 | enable_apache_modules | 296 | enable_apache_modules |
287 | systemctl restart apache2 | ||
288 | install_self_to_site | 297 | install_self_to_site |
289 | install_header_to_site | 298 | install_header_to_site |
290 | fi | 299 | fi |