static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
static time_t last_start_time = 0;
static int seq = 0;
- time_t now;
+ time_t now = time(NULL);
struct tm tm;
char dt[MAX_TIME_LENGTH];
char name[MAX_NAME_LENGTH];
char *p;
+ int len;
/* Guarantee unique start time -- maximum one per second, and
* thus unique Job Name
*/
P(mutex); /* lock creation of jobs */
- now = time(NULL);
seq++;
if (seq > 59) { /* wrap as if it is seconds */
seq = 0;
/* Form Unique JobName */
(void)localtime_r(&now, &tm);
/* Use only characters that are permitted in Windows filenames */
- strftime(dt, sizeof(dt), "%Y-%m-%d_%H.%M", &tm);
+ strftime(dt, sizeof(dt), "%Y-%m-%d_%H.%M.%S", &tm);
+ len = strlen(dt) + 5; /* dt + .%02d EOS */
bstrncpy(name, base_name, sizeof(name));
- name[sizeof(name)-22] = 0; /* truncate if too long */
+ name[sizeof(name)-len] = 0; /* truncate if too long */
bsnprintf(jcr->Job, sizeof(jcr->Job), "%s.%s.%02d", name, dt, seq); /* add date & time */
/* Convert spaces into underscores */
for (p=jcr->Job; *p; p++) {
*p = '_';
}
}
+ Dmsg2(100, "JobId=%u created Job=%s\n", jcr->JobId, jcr->Job);
}
/* Called directly from job rescheduling */
bsnprintf(seed, sizeof(seed), "%p%d", jcr, JobId);
make_session_key(auth_key, seed, 1);
dir->fsend(OKjob, jcr->VolSessionId, jcr->VolSessionTime, auth_key);
- Dmsg2(100, ">dird jid=%u: %s", (uint32_t)jcr->JobId, dir->msg);
+ Dmsg2(50, ">dird jid=%u: %s", (uint32_t)jcr->JobId, dir->msg);
jcr->sd_auth_key = bstrdup(auth_key);
memset(auth_key, 0, sizeof(auth_key));
generate_daemon_event(jcr, "JobStart");
timeout.tv_nsec = tv.tv_usec * 1000;
timeout.tv_sec = tv.tv_sec + me->client_wait;
- Dmsg3(050, "%s waiting %d sec for FD to contact SD key=%s\n",
+ Dmsg3(50, "%s waiting %d sec for FD to contact SD key=%s\n",
jcr->Job, (int)(timeout.tv_sec-time(NULL)), jcr->sd_auth_key);
/*
break;
}
}
- Dmsg3(100, "Auth=%d canceled=%d errstat=%d\n", jcr->authenticated,
+ Dmsg3(50, "Auth=%d canceled=%d errstat=%d\n", jcr->authenticated,
job_canceled(jcr), errstat);
V(mutex);
memset(jcr->sd_auth_key, 0, strlen(jcr->sd_auth_key));
if (jcr->authenticated && !job_canceled(jcr)) {
- Dmsg1(100, "Running job %s\n", jcr->Job);
+ Dmsg1(50, "Running job %s\n", jcr->Job);
run_job(jcr); /* Run the job */
}
return false;
if (!(jcr=get_jcr_by_full_name(job_name))) {
Jmsg1(NULL, M_FATAL, 0, _("FD connect failed: Job name not found: %s\n"), job_name);
Dmsg1(3, "**** Job \"%s\" not found.\n", job_name);
+ fd->close();
return;
}
- jcr->file_bsock = fd;
- jcr->file_bsock->set_jcr(jcr);
- Dmsg1(110, "Found Job %s\n", job_name);
+ Dmsg1(50, "Found Job %s\n", job_name);
if (jcr->authenticated) {
Jmsg2(jcr, M_FATAL, 0, _("Hey!!!! JobId %u Job %s already authenticated.\n"),
(uint32_t)jcr->JobId, jcr->Job);
+ Dmsg2(50, "Hey!!!! JobId %u Job %s already authenticated.\n",
+ (uint32_t)jcr->JobId, jcr->Job);
+ fd->close();
free_jcr(jcr);
return;
}
+ jcr->file_bsock = fd;
+ jcr->file_bsock->set_jcr(jcr);
+
/*
* Authenticate the File daemon
*/
if (jcr->authenticated || !authenticate_filed(jcr)) {
- Dmsg1(100, "Authentication failed Job %s\n", jcr->Job);
+ Dmsg1(50, "Authentication failed Job %s\n", jcr->Job);
Jmsg(jcr, M_FATAL, 0, _("Unable to authenticate File daemon\n"));
} else {
jcr->authenticated = true;
- Dmsg2(110, "OK Authentication jid=%u Job %s\n", (uint32_t)jcr->JobId, jcr->Job);
+ Dmsg2(50, "OK Authentication jid=%u Job %s\n", (uint32_t)jcr->JobId, jcr->Job);
}
if (!jcr->authenticated) {