user,
"/apache/log"]
+fun backupLogDirOf version1 =
+ if version1 then
+ "/afs/hcoop.net/common/etc/domtool/backup/apache/"
+ else
+ "/afs/hcoop.net/common/etc/domtool/backup/apache2/"
+
end
val public_html : string
val logDirOf : bool -> string -> string
+ val backupLogDirOf : bool -> string
end
vhostsChanged := true;
case #action fs of
Slave.Delete =>
- (if !logDeleted then
- ()
- else
- (ignore (OS.Process.system (down ()));
- logDeleted := true);
- ignore (OS.Process.system (Config.rm
- ^ " -rf "
- ^ realVhostFile));
- ignore (OS.Process.system (Config.rm
- ^ " -rf "
- ^ realLogDir oldUser)))
+ let
+ val ldir = realLogDir oldUser
+ in
+ if !logDeleted then
+ ()
+ else
+ (ignore (OS.Process.system (down ()));
+ logDeleted := true);
+ ignore (OS.Process.system (Config.rm
+ ^ " -rf "
+ ^ realVhostFile));
+ Slave.moveDirCreate {from = ldir,
+ to = Config.Apache.backupLogDirOf
+ (isVersion1 (Slave.hostname ()))}
+ end
| Slave.Add =>
let
val rld = realLogDir user
if Posix.FileSys.access (rld, []) then
()
else
- Slave.mkDirAll rld
+ Slave.moveDirCreate {from = Config.Apache.backupLogDirOf
+ (isVersion1 (Slave.hostname ())),
+ to = rld}
end
| _ =>
val remove : ''a list * ''a -> ''a list
val removeDups : ''a list -> ''a list
+
+ val copyDirCreate : { from : string, to : string } -> unit
+ val moveDirCreate : { from : string, to : string } -> unit
end
else
x :: ls) [] ls
+fun copyDirCreate {from, to} =
+ (mkDirAll to;
+ if Posix.FileSys.access (from, []) then
+ ignore (OS.Process.system ("cp -r " ^ from ^ " " ^ to))
+ else
+ ())
+
+fun moveDirCreate {from, to} =
+ (mkDirAll to;
+ if Posix.FileSys.access (from, []) then
+ ignore (OS.Process.system ("mv " ^ from ^ " " ^ to))
+ else
+ ())
+
end