/*
Bacula® - The Network Backup Solution
- Copyright (C) 2001-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2001-2008 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.
This program is Free Software; you can redistribute it and/or
modify it under the terms of version two of the GNU General Public
- License as published by the Free Software Foundation plus additions
- that are listed in the file LICENSE.
+ License as published by the Free Software Foundation and included
+ in the file LICENSE.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
char *when, *verify_job_name, *catalog_name;
char *previous_job_name;
char *since;
- char *verify_list;
+ const char *verify_list;
JOB *job;
JOB *verify_job;
JOB *previous_job;
/* Forward referenced subroutines */
static void select_job_level(UAContext *ua, JCR *jcr);
static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job,
- char *verify_list, char *jid, const char *replace,
+ const char *verify_list, char *jid, const char *replace,
char *client_name);
static void select_where_regexp(UAContext *ua, JCR *jcr);
static bool scan_command_line_arguments(UAContext *ua, run_ctx &rc);
jcr->verify_job = rc.verify_job;
jcr->previous_job = rc.previous_job;
jcr->pool = rc.pool;
+ if (jcr->pool != jcr->job->pool) {
+ pm_strcpy(jcr->pool_source, _("User input"));
+ }
set_rwstorage(jcr, rc.store);
jcr->client = rc.client;
pm_strcpy(jcr->client_name, rc.client->name());
jcr->ExpectedFiles = rc.files;
if (rc.catalog) {
jcr->catalog = rc.catalog;
+ pm_strcpy(jcr->catalog_source, _("User input"));
}
if (rc.where) {
if (jcr->where) {
/* If pool changed, update migration write storage */
- if (jcr->JobType == JT_MIGRATE) {
+ if (jcr->JobType == JT_MIGRATE || jcr->JobType == JT_COPY) {
if (!set_migration_wstorage(jcr, rc.pool)) {
goto bail_out;
}
ua->send_msg(_("Level %s not valid.\n"), rc.level_name);
goto bail_out;
}
+ rc.level_name = NULL;
}
if (rc.jid) {
/* Note, this is also MigrateJobId */
jcr->RestoreJobId = str_to_int64(rc.jid);
+ rc.jid = 0;
}
/* Run without prompting? */
goto bail_out;
}
- if (ua->cmd[0] == '.' && strncasecmp(ua->cmd, ".mod ", 5) == 0) {
- Dmsg1(000, "got: %s\n", ua->cmd);
+ if (strncasecmp(ua->cmd, ".mod ", 5) == 0 ||
+ (strncasecmp(ua->cmd, "mod ", 4) == 0 && strlen(ua->cmd) > 6)) {
parse_ua_args(ua);
rc.mod = true;
if (!scan_command_line_arguments(ua, rc)) {
add_prompt(ua, _("When")); /* 5 */
add_prompt(ua, _("Priority")); /* 6 */
if (jcr->JobType == JT_BACKUP ||
+ jcr->JobType == JT_COPY ||
jcr->JobType == JT_MIGRATE ||
jcr->JobType == JT_VERIFY) {
add_prompt(ua, _("Pool")); /* 7 */
case 7:
/* Pool or Bootstrap depending on JobType */
if (jcr->JobType == JT_BACKUP ||
+ jcr->JobType == JT_COPY ||
jcr->JobType == JT_MIGRATE ||
jcr->JobType == JT_VERIFY) { /* Pool */
rc.pool = select_pool_resource(ua);
jcr->RestoreBootstrap = bstrdup(ua->cmd);
fd = fopen(jcr->RestoreBootstrap, "rb");
if (!fd) {
+ berrno be;
ua->send_msg(_("Warning cannot open %s: ERR=%s\n"),
- jcr->RestoreBootstrap, strerror(errno));
+ jcr->RestoreBootstrap, be.bstrerror());
free(jcr->RestoreBootstrap);
jcr->RestoreBootstrap = NULL;
} else {
}
opt = do_prompt(ua, "", _("Select replace option"), NULL, 0);
if (opt >= 0) {
+ rc.replace = ReplaceOptions[opt].name;
jcr->replace = ReplaceOptions[opt].token;
}
goto try_again;
Dmsg1(800, "Calling run_job job=%x\n", jcr->job);
start_job:
- Dmsg1(100, "Using pool %s\n", jcr->pool->name());
+ Dmsg3(100, "JobId=%u using pool %s priority=%d\n", (int)jcr->JobId,
+ jcr->pool->name(), jcr->JobPriority);
JobId = run_job(jcr);
+ Dmsg4(100, "JobId=%u NewJobId=%d using pool %s priority=%d\n", (int)jcr->JobId,
+ JobId, jcr->pool->name(), jcr->JobPriority);
free_jcr(jcr); /* release jcr */
if (JobId == 0) {
ua->error_msg(_("Job failed.\n"));
return;
}
-static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, char *verify_list,
+static bool display_job_parameters(UAContext *ua, JCR *jcr, JOB *job, const char *verify_list,
char *jid, const char *replace, char *client_name)
{
Dmsg1(800, "JobType=%c\n", jcr->JobType);
jcr->JobPriority);
}
break;
+ case JT_COPY:
case JT_MIGRATE:
+ char *prt_type;
+ if (jcr->JobType == JT_COPY) {
+ prt_type = _("Run Copy job\n");
+ } else {
+ prt_type = _("Run Migration job\n");
+ }
jcr->JobLevel = L_FULL; /* default level */
if (ua->api) ua->signal(BNET_RUN_CMD);
- ua->send_msg(_("Run Migration job\n"
+ ua->send_msg("%s"
"JobName: %s\n"
"Bootstrap: %s\n"
"Client: %s\n"
"JobId: %s\n"
"When: %s\n"
"Catalog: %s\n"
- "Priority: %d\n"),
+ "Priority: %d\n",
+ prt_type,
job->name(),
NPRT(jcr->RestoreBootstrap),
jcr->client->name(),
/* Note, yes and run have no value, so do not fail */
if (!ua->argv[i] && j != YES_POS /*yes*/) {
ua->send_msg(_("Value missing for keyword %s\n"), ua->argk[i]);
- return true;
+ return false;
}
Dmsg1(800, "Got keyword=%s\n", NPRT(kw[j]));
switch (j) {
}
if (!rc.store->store) {
ua->error_msg(_("No storage specified.\n"));
- return true;
+ return false;
} else if (!acl_access_ok(ua, Storage_ACL, rc.store->store->name())) {
ua->error_msg(_("No authorization. Storage \"%s\".\n"),
rc.store->store->name());