* Version $Id$
*/
/*
- Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
+ Copyright (C) 2000-2003 Kern Sibbald and John Walker
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
if (rem_runjobs > 0) {
break;
}
- sleep(60);
+ bmicrosleep(60, 0); /* recheck once per minute */
}
/*
#ifdef xxxx_debug
if (runtime > 0) {
bstrftime(dt, sizeof(dt), runjobs[i].runtime);
- Dmsg2(000, " %s run %s\n", dt, runjobs[i].job->hdr.name);
+ Dmsg2(100, " %s run %s\n", dt, runjobs[i].job->hdr.name);
}
#endif
}
/* Now wait for the time to run the job */
for (;;) {
- int twait;
- time(&now);
+ time_t twait;
+ now = time(NULL);
twait = nexttime - now;
- if (twait <= 0) /* time to run it */
+ if (twait <= 0) { /* time to run it */
break;
- if (twait > 1) /* sleep max 20 seconds */
- twait--;
- sleep(twait);
+ }
+ bmicrosleep(twait, 0);
}
run = runjobs[jobindex].run;
job = runjobs[jobindex].job;
jcr = new_jcr(sizeof(JCR), dird_free_jcr);
ASSERT(job);
- sm_check(__FILE__, __LINE__, False);
set_jcr_defaults(jcr, job);
if (run->level) {
jcr->JobLevel = run->level; /* override run level */
/* Make sure array is big enough */
if (num_runjobs == max_runjobs) {
max_runjobs += 10;
- runjobs = (RUNJOB *) realloc(runjobs, sizeof(RUNJOB) * max_runjobs);
+ runjobs = (RUNJOB *)realloc(runjobs, sizeof(RUNJOB) * max_runjobs);
if (!runjobs)
Emsg0(M_ABORT, 0, _("Out of memory\n"));
}