HCoop
/
hcoop
/
domtool2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c189cbe
)
Proper handling of Apache log file deletion while Apache might have that file open
author
Adam Chlipala
<adamc@hcoop.net>
Fri, 15 Dec 2006 22:40:58 +0000
(22:40 +0000)
committer
Adam Chlipala
<adamc@hcoop.net>
Fri, 15 Dec 2006 22:40:58 +0000
(22:40 +0000)
configDefault/apache.cfg
patch
|
blob
|
blame
|
history
configDefault/apache.csg
patch
|
blob
|
blame
|
history
scripts/domtool-publish
patch
|
blob
|
blame
|
history
src/plugins/apache.sml
patch
|
blob
|
blame
|
history
diff --git
a/configDefault/apache.cfg
b/configDefault/apache.cfg
index
0000104
..
e1e7883
100644
(file)
--- a/
configDefault/apache.cfg
+++ b/
configDefault/apache.cfg
@@
-1,6
+1,8
@@
structure Apache :> APACHE_CONFIG = struct
val reload = "/usr/bin/sudo /usr/local/sbin/domtool-publish apache"
structure Apache :> APACHE_CONFIG = struct
val reload = "/usr/bin/sudo /usr/local/sbin/domtool-publish apache"
+val down = "/usr/bin/sudo /usr/local/sbin/domtool-publish apache-down"
+val undown = "/usr/bin/sudo /usr/local/sbin/domtool-publish apache-undown"
val confDir = "/var/domtool/vhosts"
val confDir = "/var/domtool/vhosts"
diff --git
a/configDefault/apache.csg
b/configDefault/apache.csg
index
307a47a
..
28188ac
100644
(file)
--- a/
configDefault/apache.csg
+++ b/
configDefault/apache.csg
@@
-1,6
+1,8
@@
signature APACHE_CONFIG = sig
val reload : string
signature APACHE_CONFIG = sig
val reload : string
+ val down : string
+ val undown : string
val confDir : string
val confDir : string
diff --git
a/scripts/domtool-publish
b/scripts/domtool-publish
index
60f3f27
..
fad7e85
100755
(executable)
--- a/
scripts/domtool-publish
+++ b/
scripts/domtool-publish
@@
-5,6
+5,13
@@
case $1 in
/usr/bin/rsync -r --delete /var/domtool/vhosts/ /etc/apache2/vhosts/
/etc/init.d/apache2 reload
;;
/usr/bin/rsync -r --delete /var/domtool/vhosts/ /etc/apache2/vhosts/
/etc/init.d/apache2 reload
;;
+ apache-down)
+ /etc/init.d/apache2 stop
+ ;;
+ apache-undown)
+ /usr/bin/rsync -r --delete /var/domtool/vhosts/ /etc/apache2/vhosts/
+ /etc/init.d/apache2 start
+ ;;
bind)
/usr/bin/rsync -r --delete /var/domtool/zones/ /etc/bind/zones/
/bin/cp /var/domtool/named.conf.local /etc/bind/
bind)
/usr/bin/rsync -r --delete /var/domtool/zones/ /etc/bind/zones/
/bin/cp /var/domtool/named.conf.local /etc/bind/
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
()))