cancel_sd_job(ua, "cancel", jcr);
bail_out:
+ jcr->JobId = 0;
+ free_jcr(jcr);
return 1;
}
for (bool running=true; running; ) {
running = false;
foreach_jcr(jcr) {
- if (jcr->JobId != 0) {
+ if (!jcr->is_internal_job()) {
running = true;
break;
}
} else if (strcasecmp(ua->argk[i], "mount") == 0) {
for (bool waiting=false; !waiting; ) {
foreach_jcr(jcr) {
- if (jcr->JobId != 0 &&
+ if (!jcr->is_internal_job() &&
(jcr->JobStatus == JS_WaitMedia || jcr->JobStatus == JS_WaitMount)) {
waiting = true;
break;
JCR *jcr;
/* Count Jobs running */
foreach_jcr(jcr) {
- if (jcr->JobId == 0) { /* this is us */
+ if (jcr->is_internal_job()) { /* this is us */
continue;
}
tjobs++; /* count of all jobs */
/* TODO: might want to implement filters (client, status, etc...) */
} else if (strcasecmp(ua->argk[i], NT_("all")) == 0) {
foreach_jcr(jcr) {
- if (jcr->JobId == 0) { /* Do not cancel consoles */
+ if (jcr->is_internal_job()) { /* Do not cancel consoles */
continue;
}
if (!acl_access_ok(ua, Job_ACL, jcr->job->name())) {
start_prompt(ua, _("Select Job(s):\n"));
foreach_jcr(jcr) {
char ed1[50];
- if (jcr->JobId == 0) { /* this is us */
+ if (jcr->is_internal_job()) { /* this is us */
continue;
}
bsnprintf(buf, sizeof(buf), _("JobId=%s Job=%s"), edit_int64(jcr->JobId, ed1), jcr->Job);
if (strcasecmp(ua->argk[2], "current") == 0) {
ua->send_msg(OKqstatus, ua->argk[2]);
foreach_jcr(njcr) {
- if (njcr->JobId != 0 && acl_access_ok(ua, Job_ACL, njcr->job->name())) {
+ if (!njcr->is_internal_job() && acl_access_ok(ua, Job_ACL, njcr->job->name())) {
ua->send_msg(DotStatusJob, edit_int64(njcr->JobId, ed1),
njcr->JobStatus, njcr->JobErrors);
}
pthread_mutex_destroy(&mutex_auth);
pthread_mutex_destroy(&mutex);
};
+ bool is_internal_job() {return (JobId == 0 || m_JobType == JT_SYSTEM || m_JobType == JT_CONSOLE); };
bool is_job_canceled() {return job_canceled(this); };
bool is_canceled() {return job_canceled(this); };
bool is_incomplete() { return JobStatus == JS_Incomplete; };