Skip to content

Commit

Permalink
jobs: add version information to joblog
Browse files Browse the repository at this point in the history
Sadly on the fd side there is no easy way to do it for each job
automatically.  At the moment I added it manually to backup and
restore jobs.  We will see if we want to add them somewhere else as
well.
  • Loading branch information
sebsura authored and BareosBot committed Feb 21, 2024
1 parent fabd74b commit 9ec4dcd
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions core/src/dird/job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
#include "lib/thread_specific_data.h"
#include "lib/tree.h"
#include "lib/util.h"
#include "lib/version.h"
#include "lib/watchdog.h"
#include "include/protocol_types.h"
#include "include/allow_deprecated.h"
Expand Down Expand Up @@ -445,6 +446,9 @@ static void* job_thread(void* arg)
// Let the statistics subsystem know a new Job was started.
stats_job_started();

Jmsg(jcr, M_INFO, 0, T_("Version: %s (%s) %s\n"), kBareosVersionStrings.Full,
kBareosVersionStrings.Date, kBareosVersionStrings.GetOsInfo());

if (jcr->dir_impl->res.job->MaxStartDelay != 0
&& jcr->dir_impl->res.job->MaxStartDelay
< (utime_t)(jcr->start_time - jcr->sched_time)) {
Expand Down
3 changes: 3 additions & 0 deletions core/src/filed/backup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include "lib/btimers.h"
#include "lib/parse_conf.h"
#include "lib/util.h"
#include "lib/version.h"
#include "lib/serial.h"
#include "lib/compression.h"

Expand Down Expand Up @@ -114,6 +115,8 @@ bool BlastDataToStorageDaemon(JobControlRecord* jcr, crypto_cipher_t cipher)
sd = jcr->store_bsock;

jcr->setJobStatusWithPriorityCheck(JS_Running);
Jmsg(jcr, M_INFO, 0, T_("Version: %s (%s) %s\n"), kBareosVersionStrings.Full,
kBareosVersionStrings.Date, kBareosVersionStrings.GetOsInfo());

Dmsg1(300, "filed: opened data connection %d to stored\n", sd->fd_);
ClientResource* client = nullptr;
Expand Down
1 change: 1 addition & 0 deletions core/src/filed/dir_cmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ void* process_director_commands(JobControlRecord* jcr, BareosSocket* dir)
break;
}
Dmsg1(100, "Executing %s command.\n", cmds[i].cmd);

if (!cmds[i].func(jcr)) { /* do command */
quit = true; /* error or fully terminated, get out */
Dmsg1(100, "Quit command loop. Canceled=%d\n", jcr->IsJobCanceled());
Expand Down
6 changes: 5 additions & 1 deletion core/src/filed/restore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Copyright (C) 2000-2012 Free Software Foundation Europe e.V.
Copyright (C) 2011-2012 Planets Communications B.V.
Copyright (C) 2013-2023 Bareos GmbH & Co. KG
Copyright (C) 2013-2024 Bareos GmbH & Co. KG
This program is Free Software; you can redistribute it and/or
modify it under the terms of version three of the GNU Affero General Public
Expand Down Expand Up @@ -51,6 +51,7 @@
#include "lib/base64.h"
#include "lib/serial.h"
#include "lib/compression.h"
#include "lib/version.h"

#ifdef HAVE_WIN32
# include "win32/findlib/win32.h"
Expand Down Expand Up @@ -391,6 +392,9 @@ static inline bool PopDelayedDataStreams(JobControlRecord* jcr, r_ctx& rctx)
// Restore the requested files.
void DoRestore(JobControlRecord* jcr)
{
Jmsg(jcr, M_INFO, 0, T_("Version: %s (%s) %s\n"), kBareosVersionStrings.Full,
kBareosVersionStrings.Date, kBareosVersionStrings.GetOsInfo());

BareosSocket* sd;
uint32_t VolSessionId, VolSessionTime;
int32_t file_index;
Expand Down
6 changes: 5 additions & 1 deletion core/src/stored/fd_cmds.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Copyright (C) 2000-2011 Free Software Foundation Europe e.V.
Copyright (C) 2011-2012 Planets Communications B.V.
Copyright (C) 2013-2023 Bareos GmbH & Co. KG
Copyright (C) 2013-2024 Bareos GmbH & Co. KG
This program is Free Software; you can redistribute it and/or
modify it under the terms of version three of the GNU Affero General Public
Expand Down Expand Up @@ -44,6 +44,7 @@
#include "lib/bnet.h"
#include "lib/bsock.h"
#include "lib/edit.h"
#include "lib/version.h"
#include "include/jcr.h"

namespace storagedaemon {
Expand Down Expand Up @@ -171,6 +172,9 @@ void RunJob(JobControlRecord* jcr)
jcr->run_time = jcr->start_time;
jcr->sendJobStatus(JS_Running);

Jmsg(jcr, M_INFO, 0, T_("Version: %s (%s) %s\n"), kBareosVersionStrings.Full,
kBareosVersionStrings.Date, kBareosVersionStrings.GetOsInfo());

DoFdCommands(jcr);

jcr->end_time = time(NULL);
Expand Down

0 comments on commit 9ec4dcd

Please sign in to comment.