* run <job-name> jobid=nn
*
*/
-int runcmd(UAContext *ua, char *cmd)
+int run_cmd(UAContext *ua, char *cmd)
{
JCR *jcr;
char *job_name, *level_name, *jid, *store_name, *pool_name;
char *where, *fileset_name, *client_name, *bootstrap, *replace;
- char *when;
+ char *when, *verify_job_name;
int Priority = 0;
- int i, j, found, opt;
+ int i, j, opt;
+ bool found;
JOB *job = NULL;
+ JOB *verify_job = NULL;
STORE *store = NULL;
CLIENT *client = NULL;
FILESET *fileset = NULL;
N_("when"),
N_("priority"),
N_("yes"), /* 12 -- if you change this change YES_POS too */
+ N_("run"), /* 13 -- if you change this change RUN_POS too */
+ N_("verifyjob"),
NULL};
#define YES_POS 12
+#define RUN_POS 13
if (!open_db(ua)) {
return 1;
fileset_name = NULL;
bootstrap = NULL;
replace = NULL;
+ verify_job_name = NULL;
for (i=1; i<ua->argc; i++) {
- found = False;
+ found = false;
Dmsg2(200, "Doing arg %d = %s\n", i, ua->argk[i]);
for (j=0; !found && kw[j]; j++) {
if (strcasecmp(ua->argk[i], _(kw[j])) == 0) {
- /* Note, yes has no value, so do not err */
- if (!ua->argv[i] && j != YES_POS /*yes*/) {
+ /* Note, yes and run have no value, so do not err */
+ if (!ua->argv[i] && (j != YES_POS /*yes*/ && j != RUN_POS)) {
bsendmsg(ua, _("Value missing for keyword %s\n"), ua->argk[i]);
return 1;
}
return 1;
}
job_name = ua->argv[i];
- found = True;
+ found = true;
break;
case 1: /* JobId */
if (jid) {
return 1;
}
jid = ua->argv[i];
- found = True;
+ found = true;
break;
case 2: /* client */
if (client_name) {
return 1;
}
client_name = ua->argv[i];
- found = True;
+ found = true;
break;
case 3: /* fileset */
if (fileset_name) {
return 1;
}
fileset_name = ua->argv[i];
- found = True;
+ found = true;
break;
case 4: /* level */
if (level_name) {
return 1;
}
level_name = ua->argv[i];
- found = True;
+ found = true;
break;
case 5: /* storage */
if (store_name) {
return 1;
}
store_name = ua->argv[i];
- found = True;
+ found = true;
break;
case 6: /* pool */
if (pool_name) {
return 1;
}
pool_name = ua->argv[i];
- found = True;
+ found = true;
break;
case 7: /* where */
if (where) {
return 1;
}
where = ua->argv[i];
- found = True;
+ found = true;
break;
case 8: /* bootstrap */
if (bootstrap) {
return 1;
}
bootstrap = ua->argv[i];
- found = True;
+ found = true;
break;
case 9: /* replace */
if (replace) {
return 1;
}
replace = ua->argv[i];
- found = True;
+ found = true;
break;
case 10: /* When */
if (when) {
return 1;
}
when = ua->argv[i];
- found = True;
+ found = true;
break;
case 11: /* Priority */
if (Priority) {
}
break;
case 12: /* yes */
- found = True;
+ case 13: /* run */
+ found = true;
break;
+ case 14: /* Verify Job */
+ if (verify_job_name) {
+ bsendmsg(ua, _("Verify Job specified twice.\n"));
+ return 1;
+ }
+ verify_job_name = ua->argv[i];
+ found = true;
+ break;
+
default:
break;
}
return 1;
}
+ if (verify_job_name) {
+ verify_job = (JOB *)GetResWithName(R_JOB, verify_job_name);
+ if (!verify_job) {
+ bsendmsg(ua, _("Verify Job \"%s\" not found.\n"), verify_job_name);
+ verify_job = select_job_resource(ua);
+ }
+ } else {
+ verify_job = job->verify_job;
+ }
/* Create JCR to run job */
jcr = new_jcr(sizeof(JCR), dird_free_jcr);
}
}
level_name = NULL;
+ if (jcr->JobType == JT_BACKUP) {
+ bsendmsg(ua, _("Run %s job\n\
+JobName: %s\n\
+FileSet: %s\n\
+Level: %s\n\
+Client: %s\n\
+Storage: %s\n\
+Pool: %s\n\
+When: %s\n\
+Priority: %d\n"),
+ _("Backup"),
+ job->hdr.name,
+ jcr->fileset->hdr.name,
+ level_to_str(jcr->JobLevel),
+ jcr->client->hdr.name,
+ jcr->store->hdr.name,
+ NPRT(jcr->pool->hdr.name),
+ bstrutime(dt, sizeof(dt), jcr->sched_time),
+ jcr->JobPriority);
+ } else { /* JT_VERIFY */
+ char *Name;
+ if (jcr->job->verify_job) {
+ Name = jcr->job->verify_job->hdr.name;
+ } else {
+ Name = "";
+ }
bsendmsg(ua, _("Run %s job\n\
JobName: %s\n\
FileSet: %s\n\
Client: %s\n\
Storage: %s\n\
Pool: %s\n\
+Verify Job: %s\n\
When: %s\n\
Priority: %d\n"),
- jcr->JobType==JT_BACKUP?_("Backup"):_("Verify"),
+ _("Verify"),
job->hdr.name,
jcr->fileset->hdr.name,
level_to_str(jcr->JobLevel),
jcr->client->hdr.name,
jcr->store->hdr.name,
NPRT(jcr->pool->hdr.name),
+ Name,
bstrutime(dt, sizeof(dt), jcr->sched_time),
jcr->JobPriority);
+ }
break;
case JT_RESTORE:
if (jcr->RestoreJobId == 0 && !jcr->RestoreBootstrap) {
if (jcr->JobType == JT_BACKUP ||
jcr->JobType == JT_VERIFY) {
add_prompt(ua, _("Pool")); /* 7 */
+ if (jcr->JobType == JT_VERIFY) {
+ add_prompt(ua, _("Verify Job")); /* 8 */
+ }
} else if (jcr->JobType == JT_RESTORE) {
add_prompt(ua, _("Bootstrap")); /* 7 */
add_prompt(ua, _("Where")); /* 8 */
add_prompt(ua, _("Initialize Catalog"));
add_prompt(ua, _("Verify Catalog"));
add_prompt(ua, _("Verify Volume to Catalog"));
+ add_prompt(ua, _("Verify Disk to Catalog"));
add_prompt(ua, _("Verify Volume Data (not yet implemented)"));
switch (do_prompt(ua, "", _("Select level"), NULL, 0)) {
case 0:
jcr->JobLevel = L_VERIFY_VOLUME_TO_CATALOG;
break;
case 3:
+ jcr->JobLevel = L_VERIFY_DISK_TO_CATALOG;
+ break;
+ case 4:
jcr->JobLevel = L_VERIFY_DATA;
break;
default:
}
goto try_again;
case 7:
+ /* Pool or Bootstrap depending on JobType */
if (jcr->JobType == JT_BACKUP ||
jcr->JobType == JT_VERIFY) { /* Pool */
pool = select_pool_resource(ua);
}
goto try_again;
case 8:
+ /* Verify Job */
+ if (jcr->JobType == JT_VERIFY) {
+ JOB *job = select_job_resource(ua);
+ if (job) {
+ jcr->job->verify_job = job;
+ } else {
+ jcr->job->verify_job = NULL;
+ }
+ goto try_again;
+ }
/* Where */
if (!get_cmd(ua, _("Please enter path prefix for restore (/ for none): "))) {
break;