/*
- Bacula® - The Network Backup Solution
+ Bacula(R) - The Network Backup Solution
+ Copyright (C) 2000-2015 Kern Sibbald
Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
- The main author of Bacula is Kern Sibbald, with contributions from many
- others, a complete list can be found in the file AUTHORS.
+ The original author of Bacula is Kern Sibbald, with contributions
+ from many others, a complete list can be found in the file AUTHORS.
You may use this file and others of this release according to the
license defined in the LICENSE file, which includes the Affero General
Public License, v3.0 ("AGPLv3") and some additional permissions and
terms pursuant to its AGPLv3 Section 7.
- Bacula® is a registered trademark of Kern Sibbald.
+ This notice must be preserved when any source code is
+ conveyed and/or propagated.
+
+ Bacula(R) is a registered trademark of Kern Sibbald.
*/
/*
*
jcr->JobIds = ua->jcr->JobIds;
ua->jcr->JobIds = NULL;
}
+ /* Transfer VSS component info */
+ if (ua->jcr->component_fname) {
+ jcr->component_fname = ua->jcr->component_fname;
+ ua->jcr->component_fname = NULL;
+ jcr->component_fd = ua->jcr->component_fd;
+ ua->jcr->component_fd = NULL;
+ }
+
if (!set_run_context_in_jcr(ua, jcr, rc)) {
break; /* error get out of while loop */
}
bail_out:
ua->send_msg(_("Job not run.\n"));
+ if (ua->jcr->component_fd) {
+ fclose(ua->jcr->component_fd);
+ ua->jcr->component_fd = NULL;
+ }
+ if (ua->jcr->component_fname) {
+ unlink(ua->jcr->component_fname);
+ free_and_null_pool_memory(ua->jcr->component_fname);
+ }
if (jcr) {
+ if (jcr->component_fd) {
+ fclose(jcr->component_fd);
+ jcr->component_fd = NULL;
+ }
+ if (jcr->component_fname) {
+ unlink(jcr->component_fname);
+ free_and_null_pool_memory(jcr->component_fname);
+ }
free_jcr(jcr);
}
return 0; /* do not run */
{
JobId_t JobId;
- Dmsg1(100, "Starting JobId=%d\n", rc.jr.JobId);
- JobId = run_job(jcr);
+ if (rc.jr.JobStatus == JS_Incomplete) {
+ Dmsg1(100, "Ressuming JobId=%d\n", rc.jr.JobId);
+ JobId = resume_job(jcr, &rc.jr);
+ } else {
+ Dmsg1(100, "Starting JobId=%d\n", rc.jr.JobId);
+ JobId = run_job(jcr);
+ }
Dmsg4(100, "JobId=%u NewJobId=%d pool=%s priority=%d\n", (int)jcr->JobId,
JobId, jcr->pool->name(), jcr->JobPriority);
free_jcr(jcr); /* release jcr */
static bool get_next_pool(UAContext *ua, run_ctx &rc)
{
if (rc.next_pool_name) {
- Dmsg1(100, "Have next pool override=%s\n", rc.next_pool_name);
+ Dmsg1(100, "Have next pool=%s\n", rc.next_pool_name);
rc.next_pool = GetPoolResWithName(rc.next_pool_name);
if (!rc.next_pool) {
if (*rc.next_pool_name != 0) {
}
/*
- * Restart Canceled or Failed
+ * Restart Canceled, Failed, or Incomplete Jobs
*
* Returns: 0 on error
* JobId if OK
int32_t job_status;
};
struct s_js kw[] = {
+ {"Incomplete", JS_Incomplete},
{"Canceled", JS_Canceled},
{"Failed", JS_FatalError},
{"All", 0},
return 0; /* do not run */
}
-
int modify_job_parameters(UAContext *ua, JCR *jcr, run_ctx &rc)
{
int i, opt;
rc.next_pool = select_pool_resource(ua);
if (rc.next_pool) {
jcr->next_pool = rc.next_pool;
- pm_strcpy(jcr->next_pool_source, _("Command input"));
goto try_again;
}
}
}
goto try_again;
case 12:
+ /* Plugin Options */
+ //generate_plugin_event(jcr, bEventJobConfig, &rc);
+ if (!get_cmd(ua, _("Please Plugin Options string: "))) {
+ break;
+ }
+ if (jcr->plugin_options) {
+ free(jcr->plugin_options);
+ jcr->plugin_options = NULL;
+ }
+ jcr->plugin_options = bstrdup(ua->cmd);
goto try_again;
case -1: /* error or cancel */
goto bail_out;
jcr->previous_job = rc.previous_job;
jcr->pool = rc.pool;
jcr->next_pool = rc.next_pool;
+ if (rc.next_pool) {
+ jcr->cmdline_next_pool_override = true;
+ }
if (rc.pool_name) {
pm_strcpy(jcr->pool_source, _("Command input"));
} else if (jcr->pool != jcr->job->pool) {
set_rwstorage(jcr, rc.store);
jcr->client = rc.client;
- pm_strcpy(jcr->client_name, rc.client->name());
+ if (jcr->client) {
+ pm_strcpy(jcr->client_name, rc.client->name());
+ } else {
+ pm_strcpy(jcr->client_name, "**Dummy**");
+ }
if (rc.media_type) {
if (!jcr->media_type) {
jcr->media_type = get_pool_memory(PM_NAME);
}
rc.replace = NULL;
+ /* Set Snapshot Retention (Job <- Client) */
+ if (jcr->client) {
+ jcr->snapshot_retention = jcr->client->SnapRetention;
+ }
+ if (jcr->job && jcr->job->SnapRetention > 0) {
+ jcr->snapshot_retention = jcr->job->SnapRetention;
+ }
+
if (rc.Priority) {
jcr->JobPriority = rc.Priority;
rc.Priority = 0;
if (jcr->is_JobType(JT_MIGRATE) || jcr->is_JobType(JT_COPY) ||
(jcr->is_JobType(JT_BACKUP) && jcr->is_JobLevel(L_VIRTUAL_FULL))) {
if (!set_mac_wstorage(ua, jcr, rc.pool, rc.next_pool,
- _("Storage from NextPool override"))) {
+ jcr->next_pool_source)) {
return false;
}
}
rc.replace = ReplaceOptions[0].name;
for (i=0; ReplaceOptions[i].name; i++) {
- if (ReplaceOptions[i].token == (int)jcr->replace) {
+ if (ReplaceOptions[i].token == jcr->replace) {
rc.replace = ReplaceOptions[i].name;
}
}
"%s"
"Storage: %s\n"
"When: %s\n"
- "Priority: %d\n",
+ "Priority: %d\n"
+ "%s%s%s",
job->name(),
level_to_str(jcr->getJobLevel()),
jcr->client->name(),
next_pool,
jcr->wstore?jcr->wstore->name():"*None*",
bstrutime(dt, sizeof(dt), jcr->sched_time),
- jcr->JobPriority);
+ jcr->JobPriority,
+ jcr->plugin_options?"Plugin Options: ":"",
+ jcr->plugin_options?jcr->plugin_options:"",
+ jcr->plugin_options?"\n":"");
} else {
if (jcr->is_JobLevel(L_VIRTUAL_FULL)) {
bsnprintf(next_pool, sizeof(next_pool),
"%s"
"Storage: %s (From %s)\n"
"When: %s\n"
- "Priority: %d\n"),
+ "Priority: %d\n"
+ "%s%s%s"),
job->name(),
level_to_str(jcr->getJobLevel()),
jcr->client->name(),
next_pool,
jcr->wstore?jcr->wstore->name():"*None*", jcr->wstore_source,
bstrutime(dt, sizeof(dt), jcr->sched_time),
- jcr->JobPriority);
+ jcr->JobPriority,
+ jcr->plugin_options?"Plugin Options: ":"",
+ jcr->plugin_options?jcr->plugin_options:"",
+ jcr->plugin_options?"\n":"");
}
} else { /* JT_VERIFY */
JOB_DBR jr;
"Storage: %s\n"
"When: %s\n"
"Catalog: %s\n"
- "Priority: %d\n",
+ "Priority: %d\n"
+ "Plugin Options: %s\n",
job->name(),
NPRT(jcr->RestoreBootstrap),
jcr->RegexWhere?jcr->RegexWhere:job->RegexWhere,
jcr->rstore->name(),
bstrutime(dt, sizeof(dt), jcr->sched_time),
jcr->catalog->name(),
- jcr->JobPriority);
+ jcr->JobPriority,
+ NPRTB(jcr->plugin_options));
+
} else {
ua->send_msg(_("Run Restore job\n"
"JobName: %s\n"
"Storage: %s\n"
"When: %s\n"
"Catalog: %s\n"
- "Priority: %d\n"),
+ "Priority: %d\n"
+ "Plugin Options: %s\n"),
job->name(),
NPRT(jcr->RestoreBootstrap),
jcr->RegexWhere?jcr->RegexWhere:job->RegexWhere,
jcr->rstore->name(),
bstrutime(dt, sizeof(dt), jcr->sched_time),
jcr->catalog->name(),
- jcr->JobPriority);
+ jcr->JobPriority,
+ NPRTB(jcr->plugin_options));
}
} else {
if (ua->api) {
"Storage: %s\n"
"When: %s\n"
"Catalog: %s\n"
- "Priority: %d\n",
+ "Priority: %d\n"
+ "Plugin Options: %s\n",
job->name(),
NPRT(jcr->RestoreBootstrap),
jcr->where?jcr->where:NPRT(job->RestoreWhere),
jcr->rstore->name(),
bstrutime(dt, sizeof(dt), jcr->sched_time),
jcr->catalog->name(),
- jcr->JobPriority);
+ jcr->JobPriority,
+ NPRTB(jcr->plugin_options));
+
} else {
ua->send_msg(_("Run Restore job\n"
"JobName: %s\n"
"Storage: %s\n"
"When: %s\n"
"Catalog: %s\n"
- "Priority: %d\n"),
+ "Priority: %d\n"
+ "Plugin Options: %s\n"),
job->name(),
NPRT(jcr->RestoreBootstrap),
jcr->where?jcr->where:NPRT(job->RestoreWhere),
jcr->rstore->name(),
bstrutime(dt, sizeof(dt), jcr->sched_time),
jcr->catalog->name(),
- jcr->JobPriority);
+ jcr->JobPriority,
+ NPRTB(jcr->plugin_options));
}
}
"JobId: %s\n"
"When: %s\n"
"Catalog: %s\n"
- "Priority: %d\n"),
+ "Priority: %d\n"
+ "Plugin Options: %s\n"),
replace,
jcr->client->name(),
jcr->rstore->name(),
jcr->RestoreJobId==0?"*None*":edit_uint64(jcr->RestoreJobId, ec1),
bstrutime(dt, sizeof(dt), jcr->sched_time),
jcr->catalog->name(),
- jcr->JobPriority);
+ jcr->JobPriority,
+ NPRTB(jcr->plugin_options));
}
break;
case JT_COPY:
"alljobid", /* 0 Used in a switch() */
"jobid", /* 1 */
"client", /* 2 */
- "fd", /* 3 */
+ "fd",
"fileset", /* 4 */
"level", /* 5 */
"storage", /* 6 */
"replace", /* 11 */
"when", /* 12 */
"priority", /* 13 */
- "yes", /* 14 -- if you change this change YES_POS too */
+ "yes", /* 14 -- if you change this change YES_POS too */
"verifyjob", /* 15 */
"files", /* 16 number of files to restore */
"catalog", /* 17 override catalog */
"job", /* 30 */
"mediatype", /* 31 */
"nextpool", /* 32 override next pool name */
- NULL
- };
+ NULL};
#define YES_POS 14
rc.spool_data_set = false;
rc.ignoreduplicatecheck = false;
rc.comment = NULL;
+ rc.plugin_options = NULL;
for (i=1; i<ua->argc; i++) {
Dmsg2(800, "Doing arg %d = %s\n", i, ua->argk[i]);