HCoop
/
hcoop
/
domtool2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Proper handling of Apache log file deletion while Apache might have that file open
[hcoop/domtool2.git]
/
src
/
plugins
/
apache.sml
diff --git
a/src/plugins/apache.sml
b/src/plugins/apache.sml
index
955e9d8
..
83a8ce8
100644
(file)
--- a/
src/plugins/apache.sml
+++ b/
src/plugins/apache.sml
@@
-180,9
+180,11
@@
val autoindex_option = fn (EApp ((EVar "descriptionWidth", _), w), _) =>
| _ => NONE
val vhostsChanged = ref false
| _ => NONE
val vhostsChanged = ref false
+val logDeleted = ref false
val () = Slave.registerPreHandler
val () = Slave.registerPreHandler
- (fn () => vhostsChanged := false)
+ (fn () => (vhostsChanged := false;
+ logDeleted := false))
fun findVhostUser fname =
let
fun findVhostUser fname =
let
@@
-234,7
+236,12
@@
val () = Slave.registerFileHandler (fn fs =>
vhostsChanged := true;
case #action fs of
Slave.Delete =>
vhostsChanged := true;
case #action fs of
Slave.Delete =>
- (ignore (OS.Process.system (Config.rm
+ (if !logDeleted then
+ ()
+ else
+ (ignore (OS.Process.system Config.Apache.down);
+ logDeleted := true);
+ ignore (OS.Process.system (Config.rm
^ " -rf "
^ realVhostFile));
ignore (OS.Process.system (Config.rm
^ " -rf "
^ realVhostFile));
ignore (OS.Process.system (Config.rm
@@
-265,7
+272,7
@@
val () = Slave.registerFileHandler (fn fs =>
val () = Slave.registerPostHandler
(fn () =>
(if !vhostsChanged then
val () = Slave.registerPostHandler
(fn () =>
(if !vhostsChanged then
- Slave.shellF ([Config.Apache.reload],
+ Slave.shellF ([
if !logDeleted then Config.Apache.undown else
Config.Apache.reload],
fn cl => "Error reloading Apache with " ^ cl)
else
()))
fn cl => "Error reloading Apache with " ^ cl)
else
()))