]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/ua_status.c
Fix typo
[bacula/bacula] / bacula / src / dird / ua_status.c
index 796f9fc50699d0a3603167a73f55b15ec7a710df..7618ec6932f80fa25fcf2e561d55a877e2b9d0ce 100644 (file)
@@ -32,7 +32,7 @@
 
 extern char my_name[];
 extern time_t daemon_start_time;
-extern struct s_last_job last_job;
+extern int num_jobs_run;
 
 static void list_scheduled_jobs(UAContext *ua);
 static void list_running_jobs(UAContext *ua);
@@ -202,8 +202,8 @@ static void do_director_status(UAContext *ua, char *cmd)
    bsendmsg(ua, "%s Version: " VERSION " (" BDATE ") %s %s %s\n", my_name,
            HOST_OS, DISTNAME, DISTVER);
    bstrftime_nc(dt, sizeof(dt), daemon_start_time);
-   bsendmsg(ua, _("Daemon started %s, %d Job%s run.\n"), dt, last_job.NumJobs,
-        last_job.NumJobs == 1 ? "" : "s");
+   bsendmsg(ua, _("Daemon started %s, %d Job%s run since started.\n"), 
+        dt, num_jobs_run, num_jobs_run == 1 ? "" : "s");
    /*
     * List scheduled Jobs
     */
@@ -349,7 +349,7 @@ static void list_scheduled_jobs(UAContext *ua)
    int level, num_jobs = 0;
    bool hdr_printed = false;
 
-   Dmsg0(200, "enter find_runs()\n");
+   Dmsg0(200, "enter list_sched_jobs()\n");
 
    /* Loop through all jobs */
    LockRes();
@@ -377,7 +377,7 @@ static void list_scheduled_jobs(UAContext *ua)
    } else {
       bsendmsg(ua, "\n");
    }
-   Dmsg0(200, "Leave find_runs()\n");
+   Dmsg0(200, "Leave list_sched_jobs_runs()\n");
 }
 
 static void list_running_jobs(UAContext *ua)
@@ -389,8 +389,10 @@ static void list_running_jobs(UAContext *ua)
    char level[10];
    bool pool_mem = false;
 
+   Dmsg0(200, "enter list_run_jobs()\n");
    lock_jcr_chain();
-   for (jcr=NULL; (jcr=get_next_jcr(jcr)); njobs++) {
+   foreach_jcr(jcr) {
+      njobs++;
       if (jcr->JobId == 0) {     /* this is us */
         /* this is a console or other control job. We only show console
          * jobs in the status output.
@@ -406,21 +408,19 @@ static void list_running_jobs(UAContext *ua)
    if (njobs == 0) {
       unlock_jcr_chain();
       bsendmsg(ua, _("No Running Jobs.\n"));
+      Dmsg0(200, "leave list_run_jobs()\n");
       return;
    }
    njobs = 0;
    bsendmsg(ua, _("\nRunning Jobs:\n"));
-   bsendmsg(ua, _("Level JobId  Job                        Status\n"));
-   bsendmsg(ua, _("====================================================================\n"));
-   for (jcr=NULL; (jcr=get_next_jcr(jcr)); njobs++) {
-      if (!acl_access_ok(ua, Job_ACL, jcr->job->hdr.name)) {
-        continue;
-      }
-      if (jcr->JobId == 0) {     /* this is us */
-        njobs--;
+   bsendmsg(ua, _(" JobId Level   Name                       Status\n"));
+   bsendmsg(ua, _("======================================================================\n"));
+   foreach_jcr(jcr) {
+      if (jcr->JobId == 0 || !acl_access_ok(ua, Job_ACL, jcr->job->hdr.name)) {
         free_locked_jcr(jcr);
         continue;
       }
+      njobs++;
       switch (jcr->JobStatus) {
       case JS_Created:
          msg = _("is waiting execution");
@@ -514,17 +514,17 @@ static void list_running_jobs(UAContext *ua)
       switch (jcr->JobType) {
       case JT_ADMIN:
       case JT_RESTORE:
-         bstrncpy(level, "    ", sizeof(level));
+         bstrncpy(level, "      ", sizeof(level));
         break;
       default:
         bstrncpy(level, level_to_str(jcr->JobLevel), sizeof(level));
-        level[4] = 0;
+        level[7] = 0;
         break;
       }
 
-      bsendmsg(ua, _("%-4s %6d  %-20s %s\n"), 
-        level, 
+      bsendmsg(ua, _("%6d %-6s  %-20s %s\n"), 
         jcr->JobId,
+        level, 
         jcr->Job,
         msg);
 
@@ -535,8 +535,8 @@ static void list_running_jobs(UAContext *ua)
       free_locked_jcr(jcr);
    }
    unlock_jcr_chain();
-
    bsendmsg(ua, "\n");
+   Dmsg0(200, "leave list_run_jobs()\n");
 }
 
 static void list_terminated_jobs(UAContext *ua)
@@ -551,8 +551,8 @@ static void list_terminated_jobs(UAContext *ua)
    lock_last_jobs_list();
    struct s_last_job *je;
    bsendmsg(ua, _("\nTerminated Jobs:\n"));
-   bsendmsg(ua, _(" JobId  Level   Files          Bytes Status   Finished        Name \n"));
-   bsendmsg(ua, _("======================================================================\n"));
+   bsendmsg(ua, _(" JobId  Level     Files      Bytes     Status   Finished        Name \n"));
+   bsendmsg(ua, _("========================================================================\n"));
    foreach_dlist(je, last_jobs) {
       char JobName[MAX_NAME_LENGTH];
       char *termstat;
@@ -597,7 +597,7 @@ static void list_terminated_jobs(UAContext *ua)
            *p = 0;
         }
       }
-      bsendmsg(ua, _("%6d  %-4s %8s %14s %-7s  %-8s %s\n"), 
+      bsendmsg(ua, _("%6d  %-6s %8s %14s %-7s  %-8s %s\n"), 
         je->JobId,
         level, 
         edit_uint64_with_commas(je->JobFiles, b1),