X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fuwobo%2Fsrc%2Focaml%2Fuwobo.ml;h=bea96a2a09b1cf1d61af184e658b9ddea5825138;hb=caab26f85122e0040555139c48a9111a0b2b9fff;hp=792e3e64ace55c57b448dff37256c87b4110682e;hpb=d731bfc4eff6e0de05d514daff05330680992294;p=helm.git diff --git a/helm/uwobo/src/ocaml/uwobo.ml b/helm/uwobo/src/ocaml/uwobo.ml index 792e3e64a..bea96a2a0 100644 --- a/helm/uwobo/src/ocaml/uwobo.ml +++ b/helm/uwobo/src/ocaml/uwobo.ml @@ -35,7 +35,7 @@ let debug_level = `Notice;; let debug_print s = if debug then prerr_endline s;; Http_common.debug := false;; let logfile = Some "uwobo.log";; (* relative to execution dir *) -let logfile_perm = 0o644;; +let logfile_perm = 0o640;; (* other settings *) let daemon_name = "UWOBO OCaml";; @@ -232,8 +232,12 @@ let main () = let styles = new Uwobo_styles.styles in (* (3) clean up actions *) let last_process = ref true in + let http_child = ref None in let die_nice () = (** at_exit callback *) if !last_process then begin + (match !http_child with + | None -> () + | Some pid -> Unix.kill pid Sys.sigterm); syslogger#log `Notice (sprintf "%s is terminating, bye!" daemon_name); syslogger#disable; close_out logger_outchan @@ -251,6 +255,7 @@ let main () = let (res_pipe_exit, res_pipe_entrance) = Unix.pipe () in match Unix.fork () with | child when child > 0 -> (* (4) parent: listen on cmd pipe for updates *) + http_child := Some child; let stop_http_daemon () = (* kill child *) debug_print (sprintf "Grandparent: killing pid %d" child); Unix.kill child Sys.sigterm; (* kill child ... *)