*
*/
/*
- Copyright (C) 2001-2005 Kern Sibbald
+ Copyright (C) 2001-2006 Kern Sibbald
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
#include "bacula.h"
#include "filed.h"
-extern char my_name[];
-extern int num_jobs_run;
-extern time_t daemon_start_time;
-extern bool get_trace(void);
-
/* Forward referenced functions */
static void list_terminated_jobs(void sendit(const char *msg, int len, void *sarg), void *arg);
static void bsock_sendit(const char *msg, int len, void *arg);
static char OKqstatus[] = "2000 OK .status\n";
static char DotStatusJob[] = "JobId=%d JobStatus=%c JobErrors=%d\n";
-#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+#if defined(HAVE_WIN32)
static int privs = 0;
#endif
#ifdef WIN32_VSS
len = Mmsg(msg, _("Daemon started %s, %d Job%s run since started.\n"),
dt, num_jobs_run, num_jobs_run == 1 ? "" : "s");
sendit(msg, len, arg);
-#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
- if (/*debug_level > 0*/ true) {
+#if defined(HAVE_WIN32)
+ if (debug_level > 0) {
if (!privs) {
privs = enable_backup_privileges(NULL, 1);
}
len = Mmsg(msg, " %sWUL,%sWMKD,%sWOP,%sGFAA,%sGFAW,%sGFAEA,%sGFAEW,%sSFAA,%sSFAW,%sBR,%sBW,%sSPSP,\n",
p_wunlink?"":"!",
p_wmkdir?"":"!",
- p_wopen?"":"!",
p_GetFileAttributesA?"":"!",
p_GetFileAttributesW?"":"!",
p_GetFileAttributesExA?"":"!",
sendit(msg, len, arg);
}
#endif
- if (debug_level > 0) {
- len = Mmsg(msg, _(" Heap: bytes=%s max_bytes=%s bufs=%s max_bufs=%s\n"),
- edit_uint64_with_commas(sm_bytes, b1),
- edit_uint64_with_commas(sm_max_bytes, b2),
- edit_uint64_with_commas(sm_buffers, b3),
- edit_uint64_with_commas(sm_max_buffers, b4));
- sendit(msg, len, arg);
- len = Mmsg(msg, _(" Sizeof: off_t=%d size_t=%d debug=%d trace=%d\n"),
- sizeof(off_t), sizeof(size_t), debug_level, get_trace());
- sendit(msg, len, arg);
- }
-
- list_terminated_jobs(sendit, arg);
+ len = Mmsg(msg, _(" Heap: bytes=%s max_bytes=%s bufs=%s max_bufs=%s\n"),
+ edit_uint64_with_commas(sm_bytes, b1),
+ edit_uint64_with_commas(sm_max_bytes, b2),
+ edit_uint64_with_commas(sm_buffers, b3),
+ edit_uint64_with_commas(sm_max_buffers, b4));
+ sendit(msg, len, arg);
+ len = Mmsg(msg, _(" Sizeof: off_t=%d size_t=%d debug=%d trace=%d\n"),
+ sizeof(off_t), sizeof(size_t), debug_level, get_trace());
+ sendit(msg, len, arg);
/*
* List running jobs
}
sendit(msg, len, arg);
if (njcr->JobId == 0) {
- free_jcr(njcr);
continue;
}
sec = time(NULL) - njcr->start_time;
edit_uint64_with_commas(njcr->num_files_examined, b1));
sendit(msg, len, arg);
if (njcr->JobFiles > 0) {
- P(njcr->mutex);
+ njcr->lock();
len = Mmsg(msg, _(" Processing file: %s\n"), njcr->last_fname);
- V(njcr->mutex);
+ njcr->unlock();
sendit(msg, len, arg);
}
len = Mmsg(msg, _(" SDSocket closed.\n"));
sendit(msg, len, arg);
}
- free_jcr(njcr);
}
- Dmsg0(1000, "Begin status jcr loop.\n");
+ endeach_jcr(njcr);
+
if (!found) {
len = Mmsg(msg, _("No Jobs running.\n"));
sendit(msg, len, arg);
}
len = Mmsg(msg, _("====\n"));
sendit(msg, len, arg);
+
+ list_terminated_jobs(sendit, arg);
+
free_pool_memory(msg);
}
sendit("\n", 1, arg); /* send separately */
msg = _("Terminated Jobs:\n");
sendit(msg, strlen(msg), arg);
- msg = _(" JobId Level Files Bytes Status Finished Name \n");
+ msg = _(" JobId Level Files Bytes Status Finished Name \n");
sendit(msg, strlen(msg), arg);
msg = _("======================================================================\n");
sendit(msg, strlen(msg), arg);
*p = 0;
}
}
- bsnprintf(buf, sizeof(buf), _("%6d %-6s %8s %14s %-7s %-8s %s\n"),
+ bsnprintf(buf, sizeof(buf), _("%6d %-6s %8s %10s %-7s %-8s %s\n"),
je->JobId,
level,
edit_uint64_with_commas(je->JobFiles, b1),
- edit_uint64_with_commas(je->JobBytes, b2),
+ edit_uint64_with_suffix(je->JobBytes, b2),
termstat,
dt, JobName);
sendit(buf, strlen(buf), arg);
if (njcr->JobId != 0) {
bnet_fsend(dir, DotStatusJob, njcr->JobId, njcr->JobStatus, njcr->JobErrors);
}
- free_jcr(njcr);
}
+ endeach_jcr(njcr);
} else if (strcmp(time, "last") == 0) {
bnet_fsend(dir, OKqstatus, time);
if ((last_jobs) && (last_jobs->size() > 0)) {
}
-#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
-#include <windows.h>
-
+#if defined(HAVE_WIN32)
int bacstat = 0;
struct s_win32_arg {
if (njcr->JobId != 0) {
stat = JS_Running;
termstat = _("Bacula Running");
- free_jcr(njcr);
break;
}
- free_jcr(njcr);
}
+ endeach_jcr(njcr);
+
if (stat != 0) {
goto done;
}
return buf;
}
-#endif /* HAVE_CYGWIN */
+#endif /* HAVE_WIN32 */