]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Fix #10524 About adding JobTimestamp variable for volume format
authorEric Bollengier <eric@baculasystems.com>
Mon, 6 Nov 2023 12:10:47 +0000 (13:10 +0100)
committerEric Bollengier <eric@baculasystems.com>
Tue, 13 Feb 2024 09:36:02 +0000 (10:36 +0100)
Label Format = "Vol.${JobTimestamp}"
   -> Vol.2023-10-12_20.27.20_59

bacula/src/dird/expand.c

index 4b7dba24c2982f574c20bb99ee5226a240220453..b07f52bf43b6faad3b0baf6cd4ae9366f130a5a5 100644 (file)
@@ -133,6 +133,9 @@ static int job_item(JCR *jcr, int code,
       bsnprintf(buf, sizeof(buf), "%d", jcr->previous_jr.JobId); /* Previous JobId */
       str = buf;
       break;
+   case 15:                    // Return the timestamp associated with the job name
+      str = jcr->Job + strlen(jcr->Job) - strlen("2023-10-12_20.27.20_59");
+      break;
    }
    *val_ptr = bstrdup(str);
    *val_len = strlen(str);
@@ -169,7 +172,7 @@ static struct s_built_in_vars built_in_vars[] = {
    { NT_("JobName"),   12, job_item},
    { NT_("PriorJobName"), 13, job_item},
    { NT_("PriorJobId"), 14, job_item},
-
+   { NT_("JobTimestamp"), 15, job_item},
    { NULL, 0, NULL}
 };