mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
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>
This commit is contained in:
parent
bde3f958aa
commit
339da2295b
@ -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}"
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user