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"
/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/
| _ => NONE
val vhostsChanged = ref false
+val logDeleted = ref false
val () = Slave.registerPreHandler
- (fn () => vhostsChanged := false)
+ (fn () => (vhostsChanged := false;
+ logDeleted := false))
fun findVhostUser fname =
let
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
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
()))