From ffb88078a10ad3f052d98fbc5e9f3d2fedd311bc Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 21 Mar 2008 17:45:46 +0000 Subject: [PATCH] Implement autostart scripts for Debian git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6658 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/autoconf/bacula-macros/db.m4 | 2 +- bacula/autoconf/config.h.in | 10 +-- bacula/autoconf/configure.in | 7 +- bacula/configure | 10 ++- bacula/platforms/Makefile.in | 2 +- bacula/platforms/debian/Makefile.in | 88 +++++++++++++++++++++++++ bacula/platforms/debian/bacula-dir.in | 58 ++++++++++++++++ bacula/platforms/debian/bacula-director | 59 ----------------- bacula/platforms/debian/bacula-fd.in | 58 ++++++++++++++++ bacula/platforms/debian/bacula-sd.in | 58 ++++++++++++++++ bacula/projects | 22 +++++++ bacula/technotes-2.3 | 1 + 12 files changed, 304 insertions(+), 71 deletions(-) create mode 100644 bacula/platforms/debian/Makefile.in create mode 100644 bacula/platforms/debian/bacula-dir.in delete mode 100644 bacula/platforms/debian/bacula-director create mode 100644 bacula/platforms/debian/bacula-fd.in create mode 100644 bacula/platforms/debian/bacula-sd.in diff --git a/bacula/autoconf/bacula-macros/db.m4 b/bacula/autoconf/bacula-macros/db.m4 index df2c980a85..6b94364990 100644 --- a/bacula/autoconf/bacula-macros/db.m4 +++ b/bacula/autoconf/bacula-macros/db.m4 @@ -98,7 +98,7 @@ AC_ARG_WITH(dbi, SQL_LIB=$DBI_LIBDIR/libdbi.a DBI_DBD_DRIVERDIR="-D DBI_DRIVER_DIR=\\\"$DRIVERDIR\\\"" - AC_DEFINE(HAVE_DBI) + AC_DEFINE(HAVE_DBI, 1, [Set if you have the DBI driver]) AC_MSG_RESULT(yes) db_found=yes support_dbi=yes diff --git a/bacula/autoconf/config.h.in b/bacula/autoconf/config.h.in index 1c072aac7c..5fa46139c4 100644 --- a/bacula/autoconf/config.h.in +++ b/bacula/autoconf/config.h.in @@ -21,9 +21,6 @@ /* Define to `int' if doesn't define. */ #undef ssize_t -/* Define if you want to use DBI */ -#undef HAVE_DBI - /* Define if you want to use PostgreSQL */ #undef HAVE_POSTGRESQL @@ -305,6 +302,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_CURSES_H +/* Set if you have the DBI driver */ +#undef HAVE_DBI + /* Define if the GNU dcgettext() function is already present or preinstalled. */ #undef HAVE_DCGETTEXT @@ -325,10 +325,6 @@ */ #undef HAVE_DECL_TZNAME -/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. - */ -#undef HAVE_DECL_TZNAME - /* Define to 1 if you have the declaration of `_snprintf', and to 0 if you don't. */ #undef HAVE_DECL__SNPRINTF diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index 75e849dc9e..030fe2bff9 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -1945,8 +1945,13 @@ darwin) ;; debian) DISTVER=`cat /etc/debian_version` - TAPEDRIVE="/dev/nrst0" + TAPEDRIVE="/dev/nst0" PSCMD="ps -e -o pid,command" + PFILES="${PFILES} \ + platforms/debian/Makefile \ + platforms/debian/bacula-fd \ + platforms/debian/bacula-sd \ + platforms/debian/bacula-dir" ;; freebsd) DISTVER=`uname -a |awk '{print $3}'` diff --git a/bacula/configure b/bacula/configure index 9f583fd37c..555921d121 100755 --- a/bacula/configure +++ b/bacula/configure @@ -17968,7 +17968,8 @@ echo "$as_me: error: Invalid DBD driver directory $withval - unable to find DBD SQL_LIB=$DBI_LIBDIR/libdbi.a DBI_DBD_DRIVERDIR="-D DBI_DRIVER_DIR=\\\"$DRIVERDIR\\\"" - cat >>confdefs.h <<\_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_DBI 1 _ACEOF @@ -30110,8 +30111,13 @@ darwin) ;; debian) DISTVER=`cat /etc/debian_version` - TAPEDRIVE="/dev/nrst0" + TAPEDRIVE="/dev/nst0" PSCMD="ps -e -o pid,command" + PFILES="${PFILES} \ + platforms/debian/Makefile \ + platforms/debian/bacula-fd \ + platforms/debian/bacula-sd \ + platforms/debian/bacula-dir" ;; freebsd) DISTVER=`uname -a |awk '{print $3}'` diff --git a/bacula/platforms/Makefile.in b/bacula/platforms/Makefile.in index d0808e9768..c8b24eb0f9 100644 --- a/bacula/platforms/Makefile.in +++ b/bacula/platforms/Makefile.in @@ -12,7 +12,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL = @INSTALL@ SUBDIRS = freebsd redhat solaris unknown openbsd irix gentoo \ - darwin aix bsdi mandrake slackware alpha + debian darwin aix bsdi mandrake slackware alpha MAKE = make diff --git a/bacula/platforms/debian/Makefile.in b/bacula/platforms/debian/Makefile.in new file mode 100644 index 0000000000..aa77f36013 --- /dev/null +++ b/bacula/platforms/debian/Makefile.in @@ -0,0 +1,88 @@ +# +# This file is used as the template to create the +# Makefile for the Debian/Ubuntu/Kubuntu specific installation. +# +# 21 March 2008 -- Kern Sibbald +# +# for Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ +# + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ -m 754 + +nothing: + +install: install-autostart + +install-autostart: install-autostart-fd install-autostart-sd install-autostart-dir + +install_logrotate: + @$(INSTALL_PROGRAM) ../../scripts/logrotate $(DESTDIR)/etc/logrotate.d/bacula + +install-autostart-fd: uninstall-autostart-fd + @echo "Installing bacula-fd boot script ..." + @$(INSTALL_PROGRAM) bacula-fd $(DESTDIR)/etc/init.d/bacula-fd + @echo "Installing bacula-fd symlinks ..." + @if test x$(DESTDIR) = x ; then \ + /usr/sbin/update-rc.d bacula-fd start 91 2 3 4 5 . stop 9 0 1 6 .; \ + fi + + +install-autostart-sd: uninstall-autostart-sd + @echo "Installing bacula-sd boot script ..." + @$(INSTALL_PROGRAM) bacula-sd $(DESTDIR)/etc/init.d/bacula-sd + @echo "Installing bacula-sd symlinks ..." + @if test "x$(DESTDIR)" = "x" ; then \ + /usr/sbin/update-rc.d bacula-sd start 91 2 3 4 5 . stop 9 0 1 6 .; \ + fi + + +install-autostart-dir: uninstall-autostart-dir + @echo "Installing bacula-dir boot script ..." + @$(INSTALL_PROGRAM) bacula-dir $(DESTDIR)/etc/init.d/bacula-dir + @echo "Installing bacula-dir symlinks ..." + @if test "x$(DESTDIR)" = "x" ; then \ + /usr/sbin/update-rc.d bacula-dir start 90 2 3 4 5 . stop 9 0 1 6 .; \ + fi + + +uninstall: uninstall-autostart + +uninstall-autostart: uninstall-autostart-fd uninstall-autostart-sd uninstall-autostart-dir + +uninstall-logrotate: + @rm -f $(DESTDIR)/etc/logrotate.d/bacula + +uninstall-autostart-fd: + @if test "x$(DESTDIR)" = "x" -a -f /etc/init.d/bacula-fd; then \ + /etc/init.d/bacula-fd stop; \ + rm -f $(DESTDIR)/etc/init.d/bacula-fd; \ + /usr/sbin/update-rc.d bacula-fd remove; \ + fi + + +uninstall-autostart-sd: + @if test "x$(DESTDIR)" = "x" -a -f /etc/init.d/bacula-sd; then \ + /etc/init.d/bacula-sd stop; \ + rm -f $(DESTDIR)/etc/init.d/bacula-sd; \ + /usr/sbin/update-rc.d bacula-sd remove; \ + fi + +uninstall-autostart-dir: + @if test "x$(DESTDIR)" = "x" -a -f /etc/init.d/bacula-dir; then \ + /etc/init.d/bacula-dir stop; \ + rm -f $(DESTDIR)/etc/init.d/bacula-dir; \ + /usr/sbin/update-rc.d bacula-dir remove; \ + fi + @rm -f $(DESTDIR)/etc/init.d/bacula-dir + +clean: + @rm -f 1 2 3 + +distclean: clean + @rm -f Makefile + @rm -f bacula-sd bacula-fd bacula-dir + +devclean: clean + @rm -f Makefile + @rm -f bacula-sd bacula-fd bacula-dir diff --git a/bacula/platforms/debian/bacula-dir.in b/bacula/platforms/debian/bacula-dir.in new file mode 100644 index 0000000000..19a342ddef --- /dev/null +++ b/bacula/platforms/debian/bacula-dir.in @@ -0,0 +1,58 @@ +#! /bin/sh +# +# bacula This shell script takes care of starting and stopping +# the bacula Director daemon on Debian/Ubuntu/Kubuntu +# systems. +# +# Kern E. Sibbald - 21 March 2008 +# +# For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ +# + +NAME="bacula-dir" +DESC="Bacula Director" +DAEMON=@sbindir@/${NAME} +BUSER=@dir_user@ +BGROUP=@dir_group@ +BOPTIONS="-c @sysconfdir@/${NAME}.conf" +BPORT=@dir_port@ + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +test -f $DAEMON || exit 0 + +if [ -n "`getent services ${NAME}`" ]; then + BPORT=`getent services ${NAME} | awk '{ gsub("/tcp","",$2); print $2; }'` +fi + +PIDFILE=@piddir@/${NAME}.${BPORT}.pid + +if [ "x${BUSER}" != "x" ]; then + BOPTIONS="${BOPTIONS} -u ${BUSER}" +fi +if [ "x${BGROUP}" != "x" ]; then + BOPTIONS="${BOPTIONS} -g ${BGROUP}" +fi + +case "$1" in + start) + echo -n "Starting ${DESC}: " + start-stop-daemon --start --quiet --pidfile ${PIDFILE} --exec ${DAEMON} -- ${BOPTIONS} + echo "${NAME}" + ;; + stop) + echo -n "Stopping ${DESC}: " + start-stop-daemon --oknodo --stop --quiet --exec ${DAEMON} -- ${BOPTIONS} + echo "${NAME}" + ;; + restart|force-reload) + $0 stop + sleep 5 + $0 start + ;; + *) + echo "Usage: /etc/init.d/${NAME} {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac +exit 0 diff --git a/bacula/platforms/debian/bacula-director b/bacula/platforms/debian/bacula-director deleted file mode 100644 index 4d40a11154..0000000000 --- a/bacula/platforms/debian/bacula-director +++ /dev/null @@ -1,59 +0,0 @@ -#! /bin/sh -# bacula-director SysV init script for Bacula-FD. -# -# Written by Miquel van Smoorenburg . -# Modified for Debian GNU/Linux by Ian Murdock . -# Customized for Bacula by Jose Luis Tallon -# Modified RJM 2-12-03 to fix errors with pidfile name -# -PATH=/sbin:/bin:/usr/sbin:/usr/bin -DAEMON=/usr/sbin/bacula-dir -NAME="bacula-dir" -PORT=9101 -DESC="Bacula Director" -ARGS="-c /etc/bacula/bacula-dir.conf -u bacula -g bacula" - -test -f $DAEMON || exit 0 - -set -e - -if [ -n "`getent services bacula-dir`" ]; then - PORT=`getent services bacula-dir | awk '{ gsub("/tcp","",$2); print $2; }'` -fi - -PIDFILE=/var/run/bacula/$NAME.$PORT.pid - -case "$1" in - start) - if [ -f /etc/bacula/do_not_run ]; then - echo "Not starting $DESC: disabled via /etc/bacula/do_not_run" - exit 0 - fi - - echo -n "Starting $DESC: " - start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $ARGS - echo "$NAME." - ;; - - stop) - echo -n "Stopping $DESC: " - start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE --exec $DAEMON - echo "$NAME." - ;; - - restart|force-reload) - echo -n "Restarting $DESC: " - start-stop-daemon --stop --quiet --pidfile $PIDFILE --exec $DAEMON - sleep 1 - start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $ARGS - echo "$NAME." - ;; - *) - N=/etc/init.d/$NAME - # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 - echo "Usage: $N {start|stop|restart|force-reload}" >&2 - exit 1 - ;; -esac - -exit 0 diff --git a/bacula/platforms/debian/bacula-fd.in b/bacula/platforms/debian/bacula-fd.in new file mode 100644 index 0000000000..a0bc014538 --- /dev/null +++ b/bacula/platforms/debian/bacula-fd.in @@ -0,0 +1,58 @@ +#! /bin/sh +# +# bacula This shell script takes care of starting and stopping +# the bacula Director daemon on Debian/Ubuntu/Kubuntu +# systems. +# +# Kern E. Sibbald - 21 March 2008 +# +# For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ +# + +NAME="bacula-fd" +DESC="Bacula File Daemon" +DAEMON=@sbindir@/${NAME} +BUSER=@fd_user@ +BGROUP=@fd_group@ +BOPTIONS="-c @sysconfdir@/${NAME}.conf" +BPORT=@fd_port@ + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +test -f $DAEMON || exit 0 + +if [ -n "`getent services ${NAME}`" ]; then + BPORT=`getent services ${NAME} | awk '{ gsub("/tcp","",$2); print $2; }'` +fi + +PIDFILE=@piddir@/${NAME}.${BPORT}.pid + +if [ "x${BUSER}" != "x" ]; then + BOPTIONS="${BOPTIONS} -u ${BUSER}" +fi +if [ "x${BGROUP}" != "x" ]; then + BOPTIONS="${BOPTIONS} -g ${BGROUP}" +fi + +case "$1" in + start) + echo -n "Starting ${DESC}: " + start-stop-daemon --start --quiet --pidfile ${PIDFILE} --exec ${DAEMON} -- ${BOPTIONS} + echo "${NAME}" + ;; + stop) + echo -n "Stopping ${DESC}: " + start-stop-daemon --oknodo --stop --quiet --exec ${DAEMON} -- ${BOPTIONS} + echo "${NAME}" + ;; + restart|force-reload) + $0 stop + sleep 5 + $0 start + ;; + *) + echo "Usage: /etc/init.d/${NAME} {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac +exit 0 diff --git a/bacula/platforms/debian/bacula-sd.in b/bacula/platforms/debian/bacula-sd.in new file mode 100644 index 0000000000..6b68ce1219 --- /dev/null +++ b/bacula/platforms/debian/bacula-sd.in @@ -0,0 +1,58 @@ +#! /bin/sh +# +# bacula This shell script takes care of starting and stopping +# the bacula Director daemon on Debian/Ubuntu/Kubuntu +# systems. +# +# Kern E. Sibbald - 21 March 2008 +# +# For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ +# + +NAME="bacula-sd" +DESC="Bacula Storage Daemon" +DAEMON=@sbindir@/${NAME} +BUSER=@sd_user@ +BGROUP=@sd_group@ +BOPTIONS="-c @sysconfdir@/${NAME}.conf" +BPORT=@sd_port@ + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +test -f $DAEMON || exit 0 + +if [ -n "`getent services ${NAME}`" ]; then + BPORT=`getent services ${NAME} | awk '{ gsub("/tcp","",$2); print $2; }'` +fi + +PIDFILE=@piddir@/${NAME}.${BPORT}.pid + +if [ "x${BUSER}" != "x" ]; then + BOPTIONS="${BOPTIONS} -u ${BUSER}" +fi +if [ "x${BGROUP}" != "x" ]; then + BOPTIONS="${BOPTIONS} -g ${BGROUP}" +fi + +case "$1" in + start) + echo -n "Starting ${DESC}: " + start-stop-daemon --start --quiet --pidfile ${PIDFILE} --exec ${DAEMON} -- ${BOPTIONS} + echo "${NAME}" + ;; + stop) + echo -n "Stopping ${DESC}: " + start-stop-daemon --oknodo --stop --quiet --exec ${DAEMON} -- ${BOPTIONS} + echo "${NAME}" + ;; + restart|force-reload) + $0 stop + sleep 5 + $0 start + ;; + *) + echo "Usage: /etc/init.d/${NAME} {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac +exit 0 diff --git a/bacula/projects b/bacula/projects index ac00b840aa..c007947ba0 100644 --- a/bacula/projects +++ b/bacula/projects @@ -1274,6 +1274,28 @@ Item 1: Backup and Restore of Windows Encrypted Files through raw encryption fun Run = pool=Monthly last Day of the Month at 23:50 + Date: 20 March 2008 + + Origin: Frank Sweetser + + What: Add a new SD directive, "minimum spool size" (or similar). This + directive would specify a minimum level of free space available for + spooling. If the unused spool space is less than this level, any new + spooling requests would be blocked as if the "maximum spool size" + threshold had bee reached. Already spooling jobs would be unaffected + by this directive. + + Why: I've been bitten by this scenario a couple of times: + + Assume a maximum spool size of 100M. Two concurrent jobs, A and B, are + both running. Due to timing quirks and previously running jobs, job A + has used 99.9M of space in the spool directory. While A is busy + despooling to disk, B is happily using the remaining 0.1M of spool + space. This ends up in a spool/despool sequence every 0.1M of data. + In addition to fragmenting the data on the volume far more than was + necessary, in larger data sets (ie, tens or hundreds of gigabytes) it + can easily produce multi-megabyte report emails! + ========== Already implemented ================================ Item n: make changing "spooldata=yes|no" possible for diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index 23e9be30c7..d16744522f 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -23,6 +23,7 @@ Add long term statistic job table General: 21Mar08 +kes Implement autostart scripts for Debian. ebl Implement upgrade catalog scripts. 20Mar08 ebl Apply jobstat patch for long term statistics. Have to implement -- 2.39.5