Catch OpenSSL exceptions on slave connection acceptance
[hcoop/domtool2.git] / src / tail / tail.sml
index 057853c..12576ee 100644 (file)
@@ -37,12 +37,19 @@ fun main args =
        val args = rev args
     in
        case args of
-           [vhost] =>
+           [vhost, kind] =>
            let
+               val () = case kind of
+                            "access" => ()
+                          | "error" => ()
+                          | "rewrite" => ()
+                          | _ => (print "Unsupported logfile kind.  Use 'access', 'error', or 'rewrite'.\n";
+                                  OS.Process.exit OS.Process.failure)
+
                val uid = Posix.ProcEnv.getuid ()
                val uname = Posix.SysDB.Passwd.name (Posix.SysDB.getpwuid uid)
 
-               val proc = Unix.execute ("/usr/local/bin/domtool-admin-sudo-noisy", ["perms", uname])
+               val proc = Unix.execute ("/usr/local/bin/domtool-admin", ["perms", uname])
                val inf = Unix.textInstreamOf proc
 
                fun allowed () =
@@ -73,7 +80,10 @@ fun main args =
                                ^ "/apache/log/"
                                ^ hostname ()
                                ^ "/"
-                               ^ vhost]
+                               ^ vhost
+                               ^ "/"
+                               ^ kind
+                               ^ ".log"]
 
                val tailArgs =
                    if f then