git.annexia.org
/
whenjobs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
db977dc
)
Implement 'whenjobs --daemon-status'.
author
Richard W.M. Jones
<rjones@redhat.com>
Sat, 10 Mar 2012 13:21:59 +0000
(13:21 +0000)
committer
Richard W.M. Jones
<rjones@redhat.com>
Sat, 10 Mar 2012 13:21:59 +0000
(13:21 +0000)
tools/whenjobs.ml
patch
|
blob
|
history
diff --git
a/tools/whenjobs.ml
b/tools/whenjobs.ml
index
e0f3cc9
..
db32eaf
100644
(file)
--- a/
tools/whenjobs.ml
+++ b/
tools/whenjobs.ml
@@
-424,7
+424,15
@@
and daemon_restart () =
assert false
and daemon_status () =
assert false
and daemon_status () =
- assert false
+ let r =
+ try
+ let client = start_client_no_exit () in
+ let r = Whenproto_clnt.When.V1.ping_daemon client () in
+ stop_client client;
+ r = `ok
+ with
+ exn -> false in
+ print_endline (if r then "up" else "down")
and jobs () =
let client = start_client () in
and jobs () =
let client = start_client () in
@@
-514,10
+522,7
@@
and create_tutorial file =
and start_client () =
let addr = sprintf "%s/socket" jobsdir in
let client =
and start_client () =
let addr = sprintf "%s/socket" jobsdir in
let client =
- try
- Whenproto_clnt.When.V1.create_client
- (Rpc_client.Unix addr)
- Rpc.Tcp (* not TCP, this is the same as SOCK_STREAM *)
+ try start_client_no_exit ()
with
| Unix_error ((ECONNREFUSED|ENOENT), _, _) ->
eprintf "whenjobs: error: the daemon ('whenjobsd') is not running\n";
with
| Unix_error ((ECONNREFUSED|ENOENT), _, _) ->
eprintf "whenjobs: error: the daemon ('whenjobsd') is not running\n";
@@
-528,6
+533,12
@@
and start_client () =
exit 1 in
client
exit 1 in
client
+and start_client_no_exit () =
+ let addr = sprintf "%s/socket" jobsdir in
+ Whenproto_clnt.When.V1.create_client
+ (Rpc_client.Unix addr)
+ Rpc.Tcp (* not TCP, this is the same as SOCK_STREAM *)
+
and stop_client client =
Rpc_client.shut_down client
and stop_client client =
Rpc_client.shut_down client