--- /dev/null
+#!/bin/bash
+#
+# A script which kicks out messages if a new tape is required for the next job.
+# It may be used as RunAfterJob script and it works fine for me.
+# Maybe someone considers it useful or has some ideas to improve it.
+#
+# Contributed by Dirk grosse Osterhues <digo@rbg.informatik.tu-darmstadt.de>
+#
+# select language: english (en) or german (de)
+LANG="en"
+# reciepient-address for notification
+MAILTO_ADDR="your-email-address"
+# bcc-address for notification
+BCC_ADDR="email-address"
+# directory for temp-files
+TEMP_DIR="/tmp/bacula"
+# bacula's console.conf
+CONSOLE_CONF=/etc/bacula/bconsole.conf
+############################################
+
+# test if console.conf exists
+if [ ! -f $CONSOLE_CONF ]; then
+ echo "You need to reconfigure varible \$CONSOLE_CONF"
+ exit 1
+fi
+# get todays tape
+director_output() {
+/usr/sbin/bacula-console -c $CONSOLE_CONF <<EOF
+status dir
+quit
+EOF
+}
+TODAY=`date +%d.%m.%y`
+YESTERDAY=`date +%d.%m.%y -d yesterday`
+HOST=`hostname -f`
+
+# /root/NEXT-TAPE-$TODAY will be /root/NEXT-TAPE-$YESTERDAY tomorrow ;)
+TAPE_TODAY=`director_output|awk '/^Scheduled Jobs/ { getline; getline; getline; print $6;exit }'`
+
+# did it alreadly run for at least one time?
+if test -f $TEMP_DIR/NEXT-TAPE-$YESTERDAY ; then
+ TAPE_YESTERDAY=`cat $TEMP_DIR/NEXT-TAPE-"$YESTERDAY"`
+else
+ TAPE_YESTERDAY=$TAPE_TODAY
+ echo $TAPE_YESTERDAY>$TEMP_DIR/NEXT-TAPE-$YESTERDAY
+fi
+echo $TAPE_TODAY>$TEMP_DIR/NEXT-TAPE-$TODAY
+
+# definition of language-dependent variables
+case $LANG in
+ de)
+ MAIL_SUBJECT="[Bacula] Bitte Tape wechslen!"
+ MAIL_BODY="Nachricht von Bacula-Backup-System auf $HOST:\
+ \n\n Tape entfernen:\t\""$TAPE_YESTERDAY"\"\
+ \n Tape einlegen: \t\""$TAPE_TODAY"\""
+ ;;
+ en)
+ MAIL_SUBJECT="[Bacula] Please replace Tape tonight!"
+ MAIL_BODY="Message from bacula-backup-service on $HOST:\
+ \n\n Remove Tape:\t\""$TAPE_YESTERDAY"\"\
+ \n Insert Tape:\t\""$TAPE_TODAY"\""
+ ;;
+esac
+
+# send notification
+if [ $TAPE_TODAY != $TAPE_YESTERDAY ] ; then
+ echo -e $MAIL_BODY | mail -a "X-Bacula: Tape-Notifier on $HOST" -s "`echo $MAIL_SUBJECT`" -b $BCC_ADDR $MAILTO_ADDR
+fi
+
+# remove older temp-files
+find $TEMP_DIR -type f -name NEXT-TAPE-\*| while read I; do
+ TAPE_FILE=${I##/tmp/bacula/}
+ if [ $TAPE_FILE ]; then
+ if [ $TAPE_FILE != NEXT-TAPE-$TODAY ] && [ $TAPE_FILE != NEXT-TAPE-$YESTERDAY ]; then
+ rm $TEMP_DIR/$TAPE_FILE
+ fi
+ fi
+done
For 1.37 Testing/Documentation:
+- Implement a Client filename case fold option (default = fold
+ on Win32).
- Fix list volumes to output volume retention in some other
units, perhaps via a directive.
- If opening a tape in read/write mode fails attempt to open
--- /dev/null
+
+This directory contains patches to the *previous* released version
+of Bacula. As they are developed, they will be put into this directory
+so that they are all in one place, and you can easily find all
+the patches that exist at a particular time.
+
+When a new official version of Bacula is released (for example 1.36.0),
+the patches for the previous release (for example 1.34) will be
+placed in a subdirectory, and patches for the new version will
+go into the main directory.
+
+The file "patches-version" (for example "patches-1.34.6") will
+contain a summary of each of the patches and when it was created,
+so that you can easily see the order and the purpose of each patch.
+Sometimes there may be dependencies between the patches -- i.e. a
+later patch needs a prior patch to be applied first. I'll try to
+note those, but cannot guarantee it.
+
*
*/
/*
- Copyright (C) 2000-2003 Kern Sibbald and John Walker
+ Copyright (C) 2003-2004 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
int bopen(BFILE *bfd, const char *fname, int flags, mode_t mode)
{
POOLMEM *win32_fname;
- DWORD dwaccess, dwflags;
+ DWORD dwaccess, dwflags, dwshare;
/* Convert to Windows path format */
win32_fname = get_pool_memory(PM_FNAME);
} else if (flags & O_WRONLY) { /* Open existing for write */
if (bfd->use_backup_api) {
-#ifdef HAVE_WIN32
- dwaccess = GENERIC_WRITE|/*FILE_ALL_ACCESS|*/WRITE_OWNER|WRITE_DAC/*|ACCESS_SYSTEM_SECURITY*/;
-#else
- dwaccess = GENERIC_WRITE|FILE_ALL_ACCESS|WRITE_OWNER|WRITE_DAC|ACCESS_SYSTEM_SECURITY;
-#endif
+ dwaccess = GENERIC_WRITE|WRITE_OWNER|WRITE_DAC;
dwflags = FILE_FLAG_BACKUP_SEMANTICS;
} else {
dwaccess = GENERIC_WRITE;
if (bfd->use_backup_api) {
dwaccess = GENERIC_READ|READ_CONTROL|ACCESS_SYSTEM_SECURITY;
dwflags = FILE_FLAG_BACKUP_SEMANTICS;
+ dwshare = FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE;
} else {
dwaccess = GENERIC_READ;
dwflags = 0;
+ dwshare = FILE_SHARE_READ|FILE_SHARE_WRITE;
}
bfd->fh = CreateFile(win32_fname,
dwaccess, /* Requested access */
- FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+ dwshare, /* Share modes */
NULL, /* SecurityAttributes */
OPEN_EXISTING, /* CreationDisposition */
dwflags, /* Flags and attributes */
/*
* Main routine for finding files on a file system.
- * The heart of the work is done in find_one.c
+ * The heart of the work to find the files on the
+ * system is done in find_one.c. Here we have the
+ * higher level control as well as the matching
+ * routines for the new syntax Options resource.
*
* Kern E. Sibbald, MM
*/
static int our_callback(FF_PKT *ff, void *hpkt);
static bool accept_file(FF_PKT *ff);
+/* Fold case in fnmatch() on Win32 */
+#ifdef WIN32
+static const int fnmode = FNM_CASEFOLD;
+#else
+static const int fnmode = 0;
+#endif
+
/*
* Initialize the find files "global" variables
ff->reader = fo->reader;
ff->writer = fo->writer;
for (k=0; k<fo->wild.size(); k++) {
- if (fnmatch((char *)fo->wild.get(k), ff->fname, 0) == 0) {
+ if (fnmatch((char *)fo->wild.get(k), ff->fname, fnmode) == 0) {
if (ff->flags & FO_EXCLUDE) {
return false; /* reject file */
}
for (j=0; j<incexe->opts_list.size(); j++) {
findFOPTS *fo = (findFOPTS *)incexe->opts_list.get(j);
for (k=0; k<fo->wild.size(); k++) {
- if (fnmatch((char *)fo->wild.get(k), ff->fname, 0) == 0) {
+ if (fnmatch((char *)fo->wild.get(k), ff->fname, fnmode) == 0) {
Dmsg1(400, "Reject wild1: %s\n", ff->fname);
return false; /* reject file */
}
}
}
for (j=0; j<incexe->name_list.size(); j++) {
- if (fnmatch((char *)incexe->name_list.get(j), ff->fname, 0) == 0) {
+ if (fnmatch((char *)incexe->name_list.get(j), ff->fname, fnmode) == 0) {
Dmsg1(400, "Reject wild2: %s\n", ff->fname);
return false; /* reject file */
}
case FT_NORECURSE:
case FT_NOFSCHG:
case FT_NOOPEN:
- return ff->callback(ff, hpkt);
+// return ff->callback(ff, hpkt);
/* These items can be filtered */
case FT_LNKSAVED:
* Routines used to keep and match include and exclude
* filename/pathname patterns.
*
+ * Note, this file is used for the old style include and
+ * excludes, so is deprecated. The new style code is
+ * found in find.c
+ *
* Kern E. Sibbald, December MMI
*
*/
#define FNM_LEADING_DIR 0
#endif
+/* Fold case in fnmatch() on Win32 */
+#ifdef WIN32
+static const int fnmode = FNM_CASEFOLD;
+#else
+static const int fnmode = 0;
+#endif
+
+
#undef bmalloc
#define bmalloc(x) sm_malloc(__FILE__, __LINE__, x)
for ( ; inc; inc=inc->next ) {
if (inc->pattern) {
- if (fnmatch(inc->fname, file, FNM_LEADING_DIR) == 0) {
+ if (fnmatch(inc->fname, file, fnmode|FNM_LEADING_DIR) == 0) {
return 1;
}
continue;
Dmsg0(900, "exc is NULL\n");
}
for ( ; exc; exc=exc->next ) {
- if (fnmatch(exc->fname, file, FNM_PATHNAME) == 0) {
+ if (fnmatch(exc->fname, file, fnmode|FNM_PATHNAME) == 0) {
Dmsg2(900, "Match exc pat=%s: file=%s:\n", exc->fname, file);
return 1;
}
}
if (!write_block_to_dev(dcr)) {
- if (job_canceled(jcr)) {
+ if (job_canceled(jcr) || jcr->JobType == JT_SYSTEM) {
stat = false;
} else {
stat = fixup_device_block_write_error(dcr);
/* */
#undef VERSION
#define VERSION "1.35.6"
-#define BDATE "30 September 2004"
-#define LSMDATE "30Sep04"
+#define BDATE "02 October 2004"
+#define LSMDATE "02Oct04"
/* Debug flags */
#undef DEBUG