From e732ef4d7e3b295712667e2415beda66a0c4edd1 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 2 May 2003 09:29:49 +0000 Subject: [PATCH] Doc + is_client_alive script git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@477 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/examples/is_client_alive | 21 +++++++++++++++++++++ bacula/src/console/console.c | 5 ++++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 bacula/examples/is_client_alive diff --git a/bacula/examples/is_client_alive b/bacula/examples/is_client_alive new file mode 100755 index 0000000000..e2f9315e63 --- /dev/null +++ b/bacula/examples/is_client_alive @@ -0,0 +1,21 @@ +#!/bin/sh +# +# Test if Bacula Client is alive +# exit 0 if specified client (arg1) is alive +# exit 1 if specified client (arg1) is NOT alive +# exit 2 if console could NOT connect with Director +# +OUTF=/tmp/client-${1}-alive +rm -f ${OUTF} +./console >/dev/null <<__EOD +@output /dev/null +messages +@output ${OUTF} +status client=${1} +messages +quit +__EOD +grep -s "Daemon started" ${OUTF} 2>&1 >/dev/null +rtn=$? +rm -f ${OUTF} +exit ${rtn} diff --git a/bacula/src/console/console.c b/bacula/src/console/console.c index 8b00944f95..12dbcbb4a9 100644 --- a/bacula/src/console/console.c +++ b/bacula/src/console/console.c @@ -391,7 +391,10 @@ static void terminate_console(int sig) } already_here = TRUE; free_pool_memory(args); - exit(0); + if (sig != 0) { + exit(1); + } + return; } #ifdef HAVE_READLINE -- 2.39.5