]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/filed/status.c
Additional message plus exclusion fix
[bacula/bacula] / bacula / src / filed / status.c
index da15c6fe650fb8f62b15eb38e41c88ec733486a0..6bc287862b521818e094979e0bf11658cd94ed39 100755 (executable)
@@ -3,9 +3,11 @@
  *
  *    Kern Sibbald, August MMI
  *
+ *   Version $Id$
+ *
  */
 /*
-   Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
+   Copyright (C) 2000-2003 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -44,35 +46,23 @@ static void do_status(void sendit(char *msg, int len, void *sarg), void *arg)
 
    msg = (char *)get_pool_memory(PM_MESSAGE);
    found = 0;
-   len = Mmsg(&msg, "%s Version: " VERSION " (" DATE ")\n", my_name);
+   len = Mmsg(&msg, "%s Version: " VERSION " (" BDATE ")\n", my_name);
    sendit(msg, len, arg);
    bstrftime(dt, sizeof(dt), daemon_start_time);
    len = Mmsg(&msg, _("Daemon started %s, %d Job%s run.\n"), dt, last_job.NumJobs,
         last_job.NumJobs == 1 ? "" : "s");
    sendit(msg, len, arg);
    if (last_job.NumJobs > 0) {
-      char *termstat, jstat[2];
+      char termstat[30];
 
       bstrftime(dt, sizeof(dt), last_job.end_time);
       len = Mmsg(&msg, _("Last Job %s finished at %s\n"), last_job.Job, dt);
       sendit(msg, len, arg);
-      switch (last_job.JobStatus) {
-        case JS_Terminated:
-            termstat = "OK";
-           break;
-       case JS_ErrorTerminated:
-            termstat = "Error";
-           break;
-       default:
-           jstat[0] = last_job.JobStatus;
-           jstat[1] = 0;
-           termstat = jstat;
-           break;
-      }
-          
+
+      jobstatus_to_ascii(last_job.JobStatus, termstat, sizeof(termstat));
       len = Mmsg(&msg, _("  Files=%s Bytes=%s Termination Status=%s\n"), 
-          edit_uint_with_commas(last_job.JobFiles, b1),
-          edit_uint_with_commas(last_job.JobBytes, b2),
+          edit_uint64_with_commas(last_job.JobFiles, b1),
+          edit_uint64_with_commas(last_job.JobBytes, b2),
           termstat);
       sendit(msg, len, arg);
    }
@@ -82,8 +72,11 @@ static void do_status(void sendit(char *msg, int len, void *sarg), void *arg)
       if (njcr->JobId == 0) {
          len = Mmsg(&msg, _("Director connected at: %s\n"), dt);
       } else {
-         len = Mmsg(&msg, _("JobId %d Job %s is running. Started: %s\n"), 
-            njcr->JobId, njcr->Job, dt);
+         len = Mmsg(&msg, _("JobId %d Job %s is running.\n"), 
+                   njcr->JobId, njcr->Job);
+        sendit(msg, len, arg);
+         len = Mmsg(&msg, _("    %s Job started: %s\n"), 
+                   job_type_to_str(njcr->JobType), dt);
       }
       sendit(msg, len, arg);
       if (njcr->JobId == 0) {
@@ -96,15 +89,17 @@ static void do_status(void sendit(char *msg, int len, void *sarg), void *arg)
       }
       bps = njcr->JobBytes / sec;
       len = Mmsg(&msg,  _("    Files=%s Bytes=%s Bytes/sec=%s\n"), 
-          edit_uint_with_commas(njcr->JobFiles, b1),
-          edit_uint_with_commas(njcr->JobBytes, b2),
-          edit_uint_with_commas(bps, b3));
+          edit_uint64_with_commas(njcr->JobFiles, b1),
+          edit_uint64_with_commas(njcr->JobBytes, b2),
+          edit_uint64_with_commas(bps, b3));
       sendit(msg, len, arg);
       len = Mmsg(&msg, _("    Files Examined=%s\n"), 
-          edit_uint_with_commas(njcr->num_files_examined, b1));
+          edit_uint64_with_commas(njcr->num_files_examined, b1));
       sendit(msg, len, arg);
       if (njcr->JobFiles > 0) {
+        P(njcr->mutex);
          len = Mmsg(&msg, _("    Processing file: %s\n"), njcr->last_fname);
+        V(njcr->mutex);
         sendit(msg, len, arg);
       }
 
@@ -150,7 +145,7 @@ int status_cmd(JCR *jcr)
    do_status(sendit, (void *)user);
    bnet_fsend(user, "====\n");
 
-   bnet_sig(user, BNET_EOF);
+   bnet_sig(user, BNET_EOD);
    return 1;
 }