dummy:
#
-SVRSRCS = dird.c authenticate.c autoprune.c \
- backup.c \
+SVRSRCS = dird.c admin.c authenticate.c \
+ autoprune.c backup.c \
catreq.c dird_conf.c \
fd_cmds.c getmsg.c inc_conf.c job.c \
mountreq.c msgchan.c newvol.c \
ua_purge.c ua_restore.c ua_run.c \
ua_select.c ua_server.c \
ua_status.c verify.c
-SVROBJS = dird.o authenticate.o autoprune.o \
- backup.o \
+SVROBJS = dird.o admin.o authenticate.o \
+ autoprune.o backup.o \
catreq.o dird_conf.o \
fd_cmds.o getmsg.o inc_conf.o job.o \
mountreq.o msgchan.o newvol.o \
*
* Kern Sibbald, March MM
*
- * This routine is called as a thread. It may not yet be totally
- * thread reentrant!!!
- *
* Basic tasks done here:
* Open DB and create records for this job.
* Open Message Channel with Storage daemon to tell him a job will be starting.
sd_term_msg,
term_msg);
-
Dmsg0(100, "Leave backup_cleanup()\n");
}
extern void term_scheduler();
extern void term_ua_server();
extern int do_backup(JCR *jcr);
+extern int do_admin(JCR *jcr);
extern int do_restore(JCR *jcr);
extern int do_verify(JCR *jcr);
-extern void backup_cleanup(void);
#ifdef USE_SEMAPHORE
static semlock_t job_lock;
if (jcr->job->RunBeforeJob) {
POOLMEM *before = get_pool_memory(PM_FNAME);
int status;
+ BPIPE *bpipe;
+ char line[MAXSTRING];
before = edit_run_codes(jcr, before, jcr->job->RunBeforeJob);
- status = run_program(before, 0, NULL);
+ bpipe = open_bpipe(before, 0, "r");
+ while (fgets(line, sizeof(line), bpipe->rfd)) {
+ Jmsg(jcr, M_INFO, 0, _("RunBefore: %s"), line);
+ }
+ status = close_bpipe(bpipe);
if (status != 0) {
Jmsg(jcr, M_FATAL, 0, _("RunBeforeJob returned non-zero status=%d\n"),
status);
}
break;
case JT_ADMIN:
- /* No actual job */
- do_autoprune(jcr);
- set_jcr_job_status(jcr, JS_Terminated);
+ do_admin(jcr);
+ if (jcr->JobStatus == JS_Terminated) {
+ do_autoprune(jcr);
+ }
break;
default:
Pmsg1(0, "Unimplemented job type: %d\n", jcr->JobType);
if (jcr->job->RunAfterJob) {
POOLMEM *after = get_pool_memory(PM_FNAME);
int status;
-
+ BPIPE *bpipe;
+ char line[MAXSTRING];
+
after = edit_run_codes(jcr, after, jcr->job->RunAfterJob);
- status = run_program(after, 0, NULL);
+ bpipe = open_bpipe(after, 0, "r");
+ while (fgets(line, sizeof(line), bpipe->rfd)) {
+ Jmsg(jcr, M_INFO, 0, _("RunAfter: %s"), line);
+ }
+ status = close_bpipe(bpipe);
if (status != 0) {
Jmsg(jcr, M_FATAL, 0, _("RunAfterJob returned non-zero status=%d\n"),
status);
Dmsg2(100, "Write uncompressed %d bytes, total before write=%d\n", compress_len, total);
if ((uLong)bwrite(&bfd, jcr->compress_buf, compress_len) != compress_len) {
Dmsg0(0, "===Write error===\n");
- Jmsg2(jcr, M_ERROR, 0, "Write error on %s: %s\n", ofile, berror(&bfd));
+ Jmsg2(jcr, M_ERROR, 0, _("Write error on %s: %s\n"), ofile, berror(&bfd));
goto bail_out;
}
total += compress_len;
}
#else
if (extract) {
- Jmsg(jcr, M_ERROR, 0, "GZIP data stream found, but GZIP not configured!\n");
+ Jmsg(jcr, M_ERROR, 0, _("GZIP data stream found, but GZIP not configured!\n"));
goto bail_out;
}
#endif
if (type == FT_LNK) {
/* Change owner of link, not of real file */
if (lchown(ofile, statp->st_uid, statp->st_gid) < 0) {
- Jmsg2(jcr, M_WARNING, 0, "Unable to set file owner %s: ERR=%s\n",
+ Jmsg2(jcr, M_WARNING, 0, _("Unable to set file owner %s: ERR=%s\n"),
ofile, strerror(errno));
stat = 0;
}
} else {
if (chown(ofile, statp->st_uid, statp->st_gid) < 0) {
- Jmsg2(jcr, M_WARNING, 0, "Unable to set file owner %s: ERR=%s\n",
+ Jmsg2(jcr, M_WARNING, 0, _("Unable to set file owner %s: ERR=%s\n"),
ofile, strerror(errno));
stat = 0;
}
if (chmod(ofile, statp->st_mode) < 0) {
- Jmsg2(jcr, M_WARNING, 0, "Unable to set file modes %s: ERR=%s\n",
+ Jmsg2(jcr, M_WARNING, 0, _("Unable to set file modes %s: ERR=%s\n"),
ofile, strerror(errno));
stat = 0;
}
/* FreeBSD user flags */
#ifdef HAVE_CHFLAGS
if (chflags(ofile, statp->st_flags) < 0) {
- Jmsg2(jcr, M_WARNING, 0, "Unable to set file flags %s: ERR=%s\n",
+ Jmsg2(jcr, M_WARNING, 0, _("Unable to set file flags %s: ERR=%s\n"),
ofile, strerror(errno));
stat = 0;
}
* Reset file times.
*/
if (utime(ofile, &ut) < 0) {
- Jmsg2(jcr, M_ERROR, 0, "Unable to set file times %s: ERR=%s\n",
+ Jmsg2(jcr, M_ERROR, 0, _("Unable to set file times %s: ERR=%s\n"),
ofile, strerror(errno));
stat = 0;
}
case FT_DIR:
Dmsg2(300, "Make dir mode=%o dir=%s\n", new_mode, ofile);
if (make_path(jcr, ofile, new_mode, parent_mode, uid, gid, 0, NULL) != 0) {
- Jmsg2(jcr, M_ERROR, 0, _("Could not make directory %s: ERR=%s.\n"),
+ Jmsg2(jcr, M_ERROR, 0, _("Could not make directory %s: ERR=%s\n"),
ofile, berror(ofd));
return CF_ERROR;
}
case FT_NORECURSE:
case FT_NOFSCHG:
case FT_NOOPEN:
- Jmsg2(jcr, M_ERROR, 0, _("Original file %s not saved. Stat=%d\n"), fname, type);
+ Jmsg2(jcr, M_ERROR, 0, _("Original file %s not saved: type=%d\n"), fname, type);
default:
Jmsg2(jcr, M_ERROR, 0, _("Unknown file type %d; not restored: %s\n"), type, fname);
}
/*
* Returns: > 0 index into path where last path char is.
* 0 no path
- * -1 filename is zero
+ * -1 filename is zero length
*/
static int separate_path_and_file(void *jcr, char *fname, char *ofile)
{
would fail with EEXIST. */
if (stat(dir, &stats)) {
- Jmsg(jcr, M_ERROR, 0, "Cannot create directory %s: %s\n",
+ Jmsg(jcr, M_ERROR, 0, _("Cannot create directory %s: ERR=%s\n"),
dirpath, strerror(save_errno));
fail = 1;
} else if (!S_ISDIR(stats.st_mode)) {
- Jmsg(jcr, M_ERROR, 0, "%s exists but is not a directory\n", quote(dirpath));
+ Jmsg(jcr, M_ERROR, 0, _("%s exists but is not a directory\n"), quote(dirpath));
fail = 1;
} else {
/* DIR (aka DIRPATH) already exists and is a directory. */
#endif
) {
/* Note, if we are restoring as NON-root, this may not be fatal */
- Jmsg(jcr, M_WARNING, 0, "Cannot change owner and/or group of %s: %s\n",
+ Jmsg(jcr, M_WARNING, 0, _("Cannot change owner and/or group of %s: ERR=%s\n"),
quote(dirpath), strerror(errno));
}
Dmsg0(300, "Chown done.\n");
creating an entry in that directory. This avoids making
stat and mkdir process O(n^2) file name components. */
if (cwd.do_chdir && chdir(basename_dir) < 0) {
- Jmsg(jcr, M_ERROR, 0, "Cannot chdir to directory, %s: %s\n",
+ Jmsg(jcr, M_ERROR, 0, _("Cannot chdir to directory, %s: ERR=%s\n"),
quote(dirpath), strerror(errno));
umask(oldmask);
cleanup(&cwd);
#endif
)
{
- Jmsg(jcr, M_WARNING, 0, "Cannot change owner and/or group of %s: %s\n",
+ Jmsg(jcr, M_WARNING, 0, _("Cannot change owner and/or group of %s: ERR=%s\n"),
quote(dirpath), strerror(errno));
}
}
Dmsg1(300, "Final chmod mode=%o\n", mode);
}
if ((mode & ~S_IRWXUGO) && chmod(basename_dir, mode)) {
- Jmsg(jcr, M_WARNING, 0, "Cannot change permissions of %s: %s\n",
+ Jmsg(jcr, M_WARNING, 0, _("Cannot change permissions of %s: ERR=%s\n"),
quote(dirpath), strerror(errno));
}
*(p->dirname_end) = '\0';
Dmsg2(300, "Reset parent mode=%o dir=%s\n", parent_mode, dirpath);
if (chmod(dirpath, parent_mode)) {
- Jmsg(jcr, M_WARNING, 0, "Cannot change permissions of %s: %s\n",
+ Jmsg(jcr, M_WARNING, 0, _("Cannot change permissions of %s: ERR=%s\n"),
quote (dirpath), strerror(errno));
}
}
const char *dirpath = argpath;
if (!S_ISDIR(stats.st_mode)) {
- Jmsg(jcr, M_ERROR, 0, "%s exists but is not a directory\n", quote(dirpath));
+ Jmsg(jcr, M_ERROR, 0, _("%s exists but is not a directory\n"), quote(dirpath));
return 1;
}
&& errno != EPERM
#endif
) {
- Jmsg(jcr, M_WARNING, 0, "Cannot change owner and/or group of %s: %s\n",
+ Jmsg(jcr, M_WARNING, 0, _("Cannot change owner and/or group of %s: ERR=%s\n"),
quote(dirpath), strerror(errno));
}
if (chmod(dirpath, mode)) {
- Jmsg(jcr, M_WARNING, 0, "Cannot change permissions of %s: %s\n",
+ Jmsg(jcr, M_WARNING, 0, _("Cannot change permissions of %s: ERR=%s\n"),
quote(dirpath), strerror(errno));
}
Dmsg2(300, "pathexists chmod mode=%o dir=%s\n", mode, dirpath);
/* */
#define VERSION "1.31"
#define VSTRING "1"
-#define BDATE "06 May 2003"
-#define LSMDATE "06May03"
+#define BDATE "07 May 2003"
+#define LSMDATE "07May03"
/* Debug flags */
#define DEBUG 1