X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fdird%2Fua_status.c;h=77a2fa55be1e0911eef1a8d3ba826a5fcc15b87c;hb=ee69b43a885958047271953c32ba04e22141c04e;hp=34f551565ff655a4c1c8ae2989fe9759454e96c9;hpb=cba7616fed3c9020a940a0bb0aee2d14f705db37;p=bacula%2Fbacula diff --git a/bacula/src/dird/ua_status.c b/bacula/src/dird/ua_status.c index 34f551565f..77a2fa55be 100644 --- a/bacula/src/dird/ua_status.c +++ b/bacula/src/dird/ua_status.c @@ -29,7 +29,6 @@ #include "bacula.h" #include "dird.h" -#include "ua.h" extern char my_name[]; extern time_t daemon_start_time; @@ -70,7 +69,7 @@ int statuscmd(UAContext *ua, char *cmd) } return 1; } else { - store = get_storage_resource(ua, cmd); + store = get_storage_resource(ua, 0); if (store) { do_storage_status(ua, store); } @@ -85,7 +84,7 @@ int statuscmd(UAContext *ua, char *cmd) add_prompt(ua, _("Client")); add_prompt(ua, _("All")); Dmsg0(20, "do_prompt: select daemon\n"); - if ((item=do_prompt(ua, _("Select daemon type for status"), cmd, MAX_NAME_LENGTH)) < 0) { + if ((item=do_prompt(ua, "", _("Select daemon type for status"), cmd, MAX_NAME_LENGTH)) < 0) { return 1; } Dmsg1(20, "item=%d\n", item); @@ -160,7 +159,7 @@ static void do_all_status(UAContext *ua, char *cmd) client = NULL; for (i=0; (client = (CLIENT *)GetNextRes(R_CLIENT, (RES *)client)); i++) { } - unique_client = (CLIENT **) malloc(i * sizeof(CLIENT)); + unique_client = (CLIENT **)malloc(i * sizeof(CLIENT)); /* Find Unique Client address/port */ client = (CLIENT *)GetNextRes(R_CLIENT, NULL); i = 0; @@ -239,7 +238,7 @@ static void do_director_status(UAContext *ua, char *cmd) case JS_ErrorTerminated: msg = _("has erred"); break; - case JS_Cancelled: + case JS_Canceled: msg = _("has been canceled"); break; case JS_WaitFD: @@ -252,6 +251,26 @@ static void do_director_status(UAContext *ua, char *cmd) Mmsg(&msg, _("is waiting on Storage %s"), jcr->store->hdr.name); pool_mem = TRUE; break; + case JS_WaitStoreRes: + msg = _("is waiting on max Storage jobs"); + break; + case JS_WaitClientRes: + msg = _("is waiting on max Client jobs"); + break; + case JS_WaitJobRes: + msg = _("is waiting on max Job jobs"); + break; + case JS_WaitPriority: + msg = _("is waiting for higher priority jobs to finish"); + break; + case JS_WaitMaxJobs: + msg = _("is waiting on max total jobs"); + break; + case JS_WaitStartTime: + msg = _("is waiting for its start time"); + break; + + default: msg = (char *) get_pool_memory(PM_FNAME); Mmsg(&msg, _("is in unknown state %c"), jcr->JobStatus); @@ -310,6 +329,10 @@ static void do_storage_status(UAContext *ua, STORE *store) if (!connect_to_storage_daemon(ua->jcr, 1, 15, 0)) { bsendmsg(ua, _("\nFailed to connect to Storage daemon %s.\n====\n"), store->hdr.name); + if (ua->jcr->store_bsock) { + bnet_close(ua->jcr->store_bsock); + ua->jcr->store_bsock = NULL; + } return; } Dmsg0(20, _("Connected to storage daemon\n")); @@ -331,12 +354,23 @@ static void do_client_status(UAContext *ua, CLIENT *client) /* Connect to File daemon */ ua->jcr->client = client; + /* Release any old dummy key */ + if (ua->jcr->sd_auth_key) { + free(ua->jcr->sd_auth_key); + } + /* Create a new dummy SD auth key */ + ua->jcr->sd_auth_key = bstrdup("dummy"); + /* Try to connect for 15 seconds */ bsendmsg(ua, _("Connecting to Client %s at %s:%d\n"), client->hdr.name, client->address, client->FDport); if (!connect_to_file_daemon(ua->jcr, 1, 15, 0)) { bsendmsg(ua, _("Failed to connect to Client %s.\n====\n"), client->hdr.name); + if (ua->jcr->file_bsock) { + bnet_close(ua->jcr->file_bsock); + ua->jcr->file_bsock = NULL; + } return; } Dmsg0(20, _("Connected to file daemon\n")); @@ -423,7 +457,7 @@ static void print_jobs_scheduled(UAContext *ua) Dmsg2(200, "tod=%d tom=%d\n", tod, tom); found = FALSE; - if (tod) { + if (tod) { /* Jobs scheduled today (next 24 hours) */ /* find time (time_t) job is to be run */ localtime_r(&now, &tm); hour = 0; @@ -446,8 +480,8 @@ static void print_jobs_scheduled(UAContext *ua) } } -// Dmsg2(200, "runtime=%d now=%d\n", runtime, now); - if (!found && tom) { +// Dmsg2(200, "runtime=%d now=%d\n", runtime, now); + if (!found && tom) { /* look at jobs scheduled tomorrow */ localtime_r(&tomorrow, &tm); hour = 0; for (i=0; i < 24; i++) { @@ -469,8 +503,8 @@ static void print_jobs_scheduled(UAContext *ua) prt_runtime(ua, job, level, runtime); } } - } - } + } /* end for loop over runs */ + } /* end for loop over resources */ UnlockRes(); Dmsg0(200, "Leave find_runs()\n"); }