diff options
author | Amitay Isaacs <amitay@gmail.com> | 2016-07-22 17:31:07 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2016-07-25 21:29:44 +0200 |
commit | 339da2295bd7da512e91d9941a8c2892a743bf55 (patch) | |
tree | ddcbdad1cdc0ee0059c35022a30a6ee656f2b34e /ctdb | |
parent | bde3f958aa789e2c1152337ad5d077af1b061ff6 (diff) | |
download | samba-339da2295bd7da512e91d9941a8c2892a743bf55.tar.gz |
ctdb-tool: Simplify "ctdb process-exists"
Drop the PNN part of the argument, improve output.
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'ctdb')
-rwxr-xr-x | ctdb/tests/simple/07_ctdb_process_exists.sh | 4 | ||||
-rw-r--r-- | ctdb/tools/ctdb.c | 13 |
2 files changed, 7 insertions, 10 deletions
diff --git a/ctdb/tests/simple/07_ctdb_process_exists.sh b/ctdb/tests/simple/07_ctdb_process_exists.sh index 83205aa07f6..b7492a84f19 100755 --- a/ctdb/tests/simple/07_ctdb_process_exists.sh +++ b/ctdb/tests/simple/07_ctdb_process_exists.sh @@ -46,7 +46,7 @@ pid="$out" echo "Checking for PID $pid on node $test_node" # set -e is good, but avoid it here status=0 -onnode 0 "$CTDB process-exists ${test_node}:${pid}" || status=$? +try_command_on_node $test_node "$CTDB process-exists ${pid}" || status=$? echo "$out" if [ $status -eq 0 ] ; then @@ -63,4 +63,4 @@ try_command_on_node $test_node 'echo $$' pid="$out" echo "Checking for PID $pid on node $test_node" -try_command_on_node -v 0 "! $CTDB process-exists ${test_node}:${pid}" +try_command_on_node -v $test_node "! $CTDB process-exists ${pid}" diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index cbdfbc9f68c..dd009762b5f 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -423,22 +423,19 @@ fail: */ static int control_process_exists(struct ctdb_context *ctdb, int argc, const char **argv) { - uint32_t pnn, pid; + pid_t pid; int ret; if (argc < 1) { usage(); } - if (sscanf(argv[0], "%u:%u", &pnn, &pid) != 2) { - DEBUG(DEBUG_ERR, ("Badly formed pnn:pid\n")); - return -1; - } + pid = atoi(argv[0]); - ret = ctdb_ctrl_process_exists(ctdb, pnn, pid); + ret = ctdb_ctrl_process_exists(ctdb, options.pnn, pid); if (ret == 0) { - printf("%u:%u exists\n", pnn, pid); + printf("PID %u exists\n", pid); } else { - printf("%u:%u does not exist\n", pnn, pid); + printf("PID %u does not exist\n", pid); } return ret; } |