]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix: clock diff, Dan's patch, Nic's patch, segfault
authorKern Sibbald <kern@sibbald.com>
Fri, 7 Nov 2003 10:29:25 +0000 (10:29 +0000)
committerKern Sibbald <kern@sibbald.com>
Fri, 7 Nov 2003 10:29:25 +0000 (10:29 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@798 91ce42f0-d328-0410-95d8-f526ca767f89

29 files changed:
bacula/autoconf/configure.in
bacula/kernstodo
bacula/platforms/solaris/Makefile.in
bacula/scripts/bacula.in
bacula/src/bc_types.h
bacula/src/cats/sql_list.c
bacula/src/console/console.c
bacula/src/dird/bsr.c
bacula/src/dird/fd_cmds.c
bacula/src/dird/getmsg.c
bacula/src/dird/ua_cmds.c
bacula/src/dird/ua_label.c
bacula/src/dird/ua_output.c
bacula/src/dird/ua_run.c
bacula/src/dird/ua_select.c
bacula/src/dird/verify.c
bacula/src/filed/job.c
bacula/src/filed/restore.c
bacula/src/lib/bsock.h
bacula/src/lib/btime.c
bacula/src/lib/serial.c
bacula/src/lib/util.c
bacula/src/stored/askdir.c
bacula/src/stored/dev.c
bacula/src/stored/dircmd.c
bacula/src/stored/job.c
bacula/src/stored/mount.c
bacula/src/tools/testfind.c
bacula/src/version.h

index 8eca027d8eb0e911497fe259c43c12b85c493816..54c3256ba0d6a957e42b79f8009997fc8e703e93 100644 (file)
@@ -741,7 +741,78 @@ AC_SUBST(fd_password)
 AC_SUBST(sd_password)
 
 
+#
+# Handle users and groups for each daemon
+#
+dir_user=
+AC_ARG_WITH(dir_user,
+    [  --with-dir-user=USER             specify user for Director daemon],
+    [
+       if test "x$withval" != "x" ; then       
+            dir_user=$withval
+       fi
+    ]
+)
 
+dir_group=
+AC_ARG_WITH(dir_group,
+    [  --with-dir-group=GROUP           specify group for Director daemon],
+    [
+       if test "x$withval" != "x" ; then       
+            dir_group=$withval
+       fi
+    ]
+)
+
+sd_user=
+AC_ARG_WITH(sd_user,
+    [  --with-sd-user=USER              specify user for Storage daemon],
+    [
+       if test "x$withval" != "x" ; then       
+            sd_user=$withval
+       fi
+    ]
+)
+
+sd_group=
+AC_ARG_WITH(sd_group,
+    [  --with-sd-group=GROUP            specify group for Storage daemon],
+    [
+       if test "x$withval" != "x" ; then       
+            sd_group=$withval
+       fi
+    ]
+)
+
+fd_user=
+AC_ARG_WITH(fd_user,
+    [  --with-fd-user=USER              specify user for File daemon],
+    [
+       if test "x$withval" != "x" ; then       
+            fd_user=$withval
+       fi
+    ]
+)
+
+fd_group=
+AC_ARG_WITH(fd_group,
+    [  --with-fd-group=GROUP            specify group for File daemon],
+    [
+       if test "x$withval" != "x" ; then       
+            fd_group=$withval
+       fi
+    ]
+)
+
+
+
+
+AC_SUBST(dir_user)
+AC_SUBST(dir_group)
+AC_SUBST(sd_user)
+AC_SUBST(sd_group)
+AC_SUBST(fd_user)
+AC_SUBST(fd_group)
 
 # ------------------------------------------------
 # Bacula check for various SQL database engines
@@ -1544,9 +1615,18 @@ Configuration on `date`:
   Job Output Email:          ${job_email}
   Traceback Email:           ${dump_email}
   SMTP Host Address:         ${smtp_host}
-  Director Port              ${dir_port}
-  File daemon Port           ${fd_port}
-  Storage daemon Port        ${sd_port}
+
+  Director Port:             ${dir_port}
+  File daemon Port:          ${fd_port}
+  Storage daemon Port:       ${sd_port}
+
+  Director User:            ${dir_user}
+  Director Group:           ${dir_group}
+  Storage Daemon User:      ${dir_user}
+  Storage DaemonGroup:      ${dir_group}
+  File Daemon User:         ${dir_user}
+  File Daemon Group:        ${dir_group}
+
   SQL binaries Directory      ${SQL_BINDIR}
 
   Large file support:        $largefile_support
index 39bbdee70260c3130b2ec92735faf4aca1893dc0..34093ca3d38f9db4a0d9aee4dcb9831097c5f90c 100644 (file)
@@ -1,5 +1,5 @@
                  Kern's ToDo List
-                30 September 2003 
+                05 November 2003  
 
 Documentation to do: (any release a little bit at a time)
 - Document running a test version.
@@ -24,6 +24,44 @@ Testing to do: (painful)
 - Figure out how to use ssh or stunnel to protect Bacula communications.
 
 For 1.33 Testing/Documentation:
+- Define week of year for scheduler.  W01, W02, ...
+  Week 01 of a year is per definition the first week that has the
+  Thursday in this year, which is equivalent to the week that contains the
+  fourth day of January.  In other words, the first week of a new year is
+  the week that has the majority of its days in the new year.  Week 01
+  might also contain days from the previous year and the week before week
+  01 of a year is the last week (52 or 53) of the previous year even if it
+  contains days from the new year.  A week starts with Monday (day 1) and
+  ends with Sunday (day 7).  For example, the first week of the year 1997
+  lasts from 1996-12-30 to 1997-01-05 and can be written in standard
+  notation as
+
+    1997-W01 or 1997W01
+
+  The week notation can also be extended by a number indicating the day
+  of the week.  For example, the day 1996-12-31, which is the Tuesday (day
+  2) of the first week of 1997, can also be written as
+
+    1997-W01-2 or 1997W012
+
+- Implement a Mount Command and an Unmount Command where
+  the users could specify a system command to be performed
+  to do the mount, after which Bacula could attempt to
+  read the device. This is for Removeable media such as a CDROM.
+  - Most likely, this mount command would be invoked explicitly
+  by the user using the current Console "mount" and "unmount" 
+  commands -- the Storage Daemon would do the right thing 
+  depending on the exact nature of the device.
+  - As with tape drives, when Bacula wanted a new removable
+  disk mounted, it would unmount the old one, and send a message
+  to the user, who would then use "mount" as described above 
+  once he had actually inserted the disk.
+- Implement dump/print label to UA
+- Implement disk spooling. Two parts: 1. Spool to disk then
+  immediately to tape to speed up tape operations. 2. Spool to
+  disk only when the tape is full, then when a tape is hung move
+  it to tape.
+- Scratch Pool where the volumes can be re-assigned to any Pool.
 - bextract is sending everything to the log file ****FIXME****
 - Document new alias records in Director. SDAddress SDDeviceName, SDPassword.
   FDPassword, FDAddress, DBAddress, DBPort, DBPassword.
@@ -42,19 +80,58 @@ For 1.33 Testing/Documentation:
     Manufufactur  : Qualstar
     Tapes         : 12 (AIT1: 36GB, AIT2: 50GB all uncompressed)
     Drives        : 2xAIT2 (installed in the Qualstar: SONY SDX-500C AIT2)
-
-
+- Setup a standard job that builds a bootstrap file and saves
+  it with the catalog database.
+- Document Dan's new --with-dir-user, ... options.
                 
 For 1.33
-- Estimate to Tibs never returns.
+- Add Progress command that periodically reports the progress of
+  a job or all jobs.
+- Restrict characters permitted in a Resource name, and don't permit
+  duplicate names.
+- Allow multiple Storage specifications (or multiple names on
+  a single Storage specification) in the Job record. Thus a job 
+  can be backed up to a number of storage devices.
+- Implement some way for the File daemon to contact the Director 
+  to start a job or pass its DHCP obtained IP number.
+- Implement multiple Consoles.
+- Implement a query tape prompt/replace feature for a console
+- Make sure that Volumes are recycled based on "Least recently used"
+  rather than lowest MediaId.
+- Implement RestoreJobRetention? Maybe better "JobRetention" in a Job,
+  which would take precidence over the Catalog "JobRetention".
+- Implement Label Format in Add and Label console commands.
+- Enhance "update slots" to include a "scan" feature
+  scan 1; scan 1-5; scan 1,2,4 ...  to update the catalog 
+- Allow a slot or range of slots on the label barcodes command.
+- Fix time difference problem between Bacula and Client
+  so that everything is in GMT.
+- Finish implementation of Verify=DiskToCatalog
+- Change console to bconsole.
+- Change smtp to bsmtp.
+- Possibly up network buffers to 65K.
+- Keep last 5 or 10 completed jobs and show them in a similar list.
+- Make a Running Jobs: output similar to current Scheduled Jobs:
 - Fix TimeZone problem!
-- Recycling volume with a Slot requires an operator intervention:
-    rufus-dir: Start Backup JobId 18, Job=kernsave.2003-11-01_21.23.52
-    rufus-dir: Pruned 1 Job on Volume Vol01 from catalog.
-    rufus-dir: There are no Jobs associated with Volume Vol01. Marking it purged.
-    rufus-dir: Recycled volume "Vol01"
-    rufus-sd: Please mount Volume "Vol01" on Storage Device "DDS-4" for Job kernsave.2003-11-01_21.23.52
-    Use "mount" command to release Job.
+- Optimize fsf not to read.
+- Use ioctl() fsf if it exists. Figure out where we are from
+  the mt_status command. Use slow fsf only if other does
+  not work.
+- Add flag to write only one EOF mark on the tape.
+- Implement autochange testing in btape.
+- From Johan?
+    Two jobs ready to go, first one blocked waiting for media
+    Cancel 2nd job ("waiting execution" one)
+    Cancel blocked job
+    boom - segfault*
+- Copy console @ code to gnome2-console
+- Make AES the only encryption algorithm see 
+  http://csrc.nist.gov/CryptoToolkit/aes/).  It's
+  an officially adopted standard, has survived peer
+  review, and provides keys up to 256 bits.
+- Add ctl-c to console to stop current command and discard buffered
+  output.
+- Estimate to Tibs never returns.
 - Think about how space could be freed up on a tape -- perhaps this
   is a Merge or Compact feature that is needed.
 - Modify FileSet, did not upgrade the current Increment job, but
@@ -64,14 +141,11 @@ For 1.33
   is located.
 - Take a careful look at Level for the estimate command, maybe make
   it a command line option.
-- Optimize fsf not to read.
-- Implement Dan's bacula script (email of 26 Oct).
-- Implement autochange testing in btape.
 - Add Volume name to "I cannot write on this volume because"
 - Make restore job check if all the files are actually restored.
 - Make tree walk routines like cd, ls, ... more user friendly
   by handling spaces better.
-- Write your PID file and chwon root:wheel before drop.
+- Write your PID file and chown root:wheel before drop.
 - Make sure there is no symlink in a file before creating a
   file (attack).
 - Look at mktemp or mkstemp(3).
@@ -89,13 +163,6 @@ For 1.33
     gotten the CPU and created the file.  You must use atomic functions
     (those that don't get interrupted by other processes) and O_EXCL is
     the only way for this particular example.
-- Keep last 5 or 10 completed jobs and show them in a similar
-  list.
-- Make a Running Jobs: output similar to current Scheduled Jobs:
-- Use ioctl() fsf if it exists. Figure out where we are from
-  the mt_status command. Use slow fsf only if other does
-  not work.
-- Add flag to write only one EOF mark on the tape.
 - Mount a tape that is not right for the job (wrong # files on tape)
   Bacula asks for another tape, fix problems with first tape and
   say "mount". All works OK, but status shows:
@@ -109,12 +176,6 @@ For 1.33
   in in Job records, walk through the pool resources.
 - Check and double check tree code, why does it take so long?
 - Upgrade to cygwin 1.5
-- Fix time difference problem between Bacula and Client
-  so that everything is in GMT.
-- Finish implementation of Verify=DiskToCatalog
-- Change console to bconsole.
-- Change smtp to bsmtp.
-- Possibly up network buffers to 65K.
 - Add device name to "Current Volume not acceptable because ..."
 - Make sure that Bacula rechecks the tape after the 20 min wait.
 - Set IO_NOWAIT on Bacula TCP/IP packets.
@@ -122,17 +183,13 @@ For 1.33
   Windows partition.
 - Report CVS problems to SourceForge.
 - Implement .consolerc for Console
-- Is it really important to make Job name the same to find the
-  Full backup to avoid promoting an Incremental job?
-- Start label, then run job when tape labeled, it should broadcast.
-- Zap illegal characters in job name for mail files (e.g. /).
 - From Lars Köllers:
     Yes, it would allow to highly automatic the request for new tapes. If a 
     tape is empty, bacula reads the barcodes (native or simulated), and if 
     an unused tape is found, it runs the label command with all the 
     necessary parameters.
 
-    By the way can bacula automatically "move" an empry/purged volume say 
+    By the way can bacula automatically "move" an empty/purged volume say 
     in the "short" pool to the "long" pool if this pool runs out of volume 
     space?
 - Either restrict the characters in a name, or fix the problem 
@@ -180,9 +237,6 @@ For 1.33
      I think Restore jobs also fall into category 2 above ....  so one might
      want to make that "The Job record has an EndTime,, but no associated
      JobMedia record, and is not a Restore job."  
-- Implement RestoreJobRetention? Maybe better "JobRetention" in a Job,
-  which would take precidence over the Catalog "JobRetention".
-- Implement Label Format in Add and Label console commands.
 - make "btape /tmp" work.
 - Make sure a rescheduled job is properly reported by status.
 - Walk through the Pool records rather than the Job records
@@ -195,17 +249,11 @@ For 1.33
   is rescheduled.
 - Fix get_storage_from_media_type (ua_restore) to use command line     
   storage=
-- Enhance "update slots" to include a "scan" feature
-  scan 1; scan 1-5; scan 1,2,4 ...  to update the catalog 
-- Allow a slot or range of slots on the label barcodes command.
 - Don't print "Warning: Wrong Volume mounted ..." if mounting second volume.
 - Make Dmsg look at global before calling subroutine.
 - Enable trace output at runtime for Win32
-- Make sure that Volumes are recycled based on "Least recently used"
-  rather than lowest MediaId.
 - Available volumes for autochangers (see patrick@baanboard.com 3 Sep 03 
   and 4 Sep) scan slots.
-- Get MySQL 3.23.58
 - Get and test MySQL 4.0
 - Do a complete audit of all pthreads_mutex, cond, ... to ensure that
   any that are dynamically initialized are destroyed when no longer used.
@@ -247,9 +295,6 @@ For 1.33
   time as the user walks through the tree).
 - Possibly use the hash code if the user selects all for a restore command.
 - Orphaned Dir buffer at parse_conf.c:373 =>  store_dir
-- Implement some way for the File daemon to contact the Director 
-  to start a job or pass its DHCP obtained IP number.
-- Implement multiple Consoles.
 - Add Console usr permissions.
 - Fix "restore all" to bypass building the tree.
 - Fix restore to list errors if Invalid block found, and if # files
@@ -260,11 +305,9 @@ For 1.33
   be sure this works with admin jobs so that the user can get
   prompted to insert the correct tape.  Possibly some way to say to
   run the job but don't save the files.
-- Add JobName= to VerifyToCatalog so that all verifies can be done at the end.
 - Implement FileOptions (see end of this document)
 - Make things like list where a file is saved case independent for
   Windows.
-- Edit the Client/Storage name into authentication failure messages.
 - Implement migrate
 - Implement a PostgreSQL driver.
 - Bacula needs to propagate SD errors.
@@ -276,8 +319,6 @@ For 1.33
   > > prod4-sd: End of medium on Volume "REU007" Bytes=16,303,521,933 
 
 - Use autochanger to handle multiple devices.
-- Fix packet too big problem. This is most likely a Windows TCP stack 
-  problem.
 - Add SuSE install doc to list.
 - Check and rechedk "Invalid block number"
 - Make bextract release the drive properly between tapes 
@@ -292,16 +333,10 @@ For 1.33
 - Something is not right in last block of fill command.
 - Implement a Recycle command
 - Add FileSet to command line arguments for restore.
-- Allow multiple Storage specifications (or multiple names on
-  a single Storage specification) in the Job record. Thus a job 
-  can be backed up to a number of storage devices.
 - Add client name to cram-md5 challenge so Director can immediately
   verify if it is the correct client.
-- Implement ClientRunBeforeJob and ClientRunAfterJob.
 - Add JobLevel in FD status (but make sure it is defined).
 - Audit all UA commands to ensure that we always prompt where possible.
-- Restrict characters permitted in a Resource name, and don't permit
-  duplicate names.
 - Check Jmsg in bnet, may not work, must dup bsock.
 - Suppress Job Name in Jmsg for console
 - Create Pools that are referenced in a Run statement at startup if possible.
@@ -327,12 +362,7 @@ For 1.33
   all Differential and Incremental jobs obsoleted by that Full backup.
   This would let people minimize the number of tapes they're keeping on
   hand without having to master the art of retention times.
-- Implement new serialize subroutines
-   send(socket, "string", &Vol, "uint32", &i, NULL)
-- Scratch Pool where the volumes can be re-assigned to any Pool.
 - Implement a M_SECURITY message class.
-- Implement forward spacing block/file: position_device(bsr) --
-  just before read_block_from_device();
 - When doing a Backup send all attributes back to the Director, who
   would then figure out what files have been deleted.
 - Currently in mount.c:236 the SD simply creates a Volume. It should have
@@ -347,11 +377,6 @@ For 1.33
   low level routines by accessing it and using Jmsg().
 - Cancel waiting for Client connect in SD if FD goes away.
 
-- Add Progress command that periodically reports the progress of
-  a job or all jobs.
-- One block was orphaned in the SD probably after cancel.
-
-
 - Examine Bare Metal restore problem (a FD crash exists somewhere ...).
 - Implement timeout in response() when it should come quickly.
 - Implement console @echo command.
@@ -366,30 +391,12 @@ For 1.33
 - Implement restore "current system", but take all files without
   doing selection tree -- so that jobs without File records can
   be restored.
-- Implement disk spooling. Two parts: 1. Spool to disk then
-  immediately to tape to speed up tape operations. 2. Spool to
-  disk only when the tape is full, then when a tape is hung move
-  it to tape.
 - Implement a relocatable bacula.spec 
-- Implement dump/print label to UA
 - Add prefixlinks to where or not where absolute links to FD.
 - Issue message to mount a new tape before the rewind.
 - Simplified client job initiation for portables.
 - If SD cannot open a drive, make it periodically retry.
-- Implement LabelTemplate (at least first cut).
 - Add more of the config info to the tape label.
-- Implement a Mount Command and an Unmount Command where
-  the users could specify a system command to be performed
-  to do the mount, after which Bacula could attempt to
-  read the device. This is for Removeable media such as a CDROM.
-  - Most likely, this mount command would be invoked explicitly
-  by the user using the current Console "mount" and "unmount" 
-  commands -- the Storage Daemon would do the right thing 
-  depending on the exact nature of the device.
-  - As with tape drives, when Bacula wanted a new removable
-  disk mounted, it would unmount the old one, and send a message
-  to the user, who would then use "mount" as described above 
-  once he had actually inserted the disk.
 
 - If tape is marked read-only, then try opening it read-only rather than
   failing, and remember that it cannot be written.
@@ -441,7 +448,6 @@ For 1.33
 - Compare tape to Client files (attributes, or attributes and data) 
 - Make all database Ids 64 bit.
 - Write an applet for Linux.
-- Implement new inter-daemon communications protocol.
 - Allow console commands to detach or run in background.
 - Fix status delay on storage daemon during rewind.
 - Add SD message variables to control operator wait time
@@ -614,113 +620,6 @@ Migration triggered by:
   Highwater mark (keep total size)
   Lowwater mark
   
-Projects:
-            Bacula Projects Roadmap 
-               17 August 2002
-           last update 8 May 2003
-
-Item 1:   Multiple simultaneous Jobs. (done)
-Done
-
-Item 3:   Write the bscan program -- also write a bcopy program.
-Done
-
-Item 5:   Implement Label templates
-Done 
-
-Item 6:   Write a regression script.
-Done --   Continue to expand its testing.
-
-Item 9:   Add SSL to daemon communications.
-For now, implement with stunnel
-
-Item 10:  Define definitive tape format.
-Done (version 1.27)
-
---- Not completed
-Item 4:   Implement Base jobs.
-
-  What:   A base job is sort of like a Full save except that you 
-          will want the FileSet to contain only files that are unlikely
-          to change in the future (i.e. a snapshot of most of your
-          system after installing it). After the base job has been run,
-          when you are doing a Full save, you can specify to exclude
-          all files saved by the base job that have not been modified.
-
-  Why:    This is something none of the competition does, as far as we know
-          (except BackupPC, which is a Perl program that saves to disk
-          only).  It is big win for the user, it makes Bacula stand out
-          as offering a unique optimization that immediately saves time
-          and money.
-
-  Notes:  Big savings in tape usage. Will require more resources because
-          the e. DIR must send FD a list of files/attribs, and the FD must
-          search the list and compare it for each file to be saved.
-
-Item 2:   Make the Storage daemon use intermediate file storage to buffer data.
-Deferred -- not necessary yet -- possibly implement with Migration.
-
-  What:   If data is coming into the SD too fast, buffer it to 
-          disk if the user has configured this option.
-
-  Why:    This would be nice, especially if it more or less falls out
-          when implementing (1) above.  If not, it probably should not
-          be given a high priority because fundamentally the backup time
-          is limited by the tape bandwidth.  Even though you may finish a
-          client job quicker by spilling to disk, you still have to
-          eventually get it onto tape.  If intermediate disk buffering
-          allows us to improve write bandwidth to tape, it may make
-          sense.
-
-  Notes:  Whether or not this is implemented will depend upon performance
-          testing after item 1 is implemented.
-
-Item 7:   GUI for interactive restore
-Item 8:   GUI for interactive backup
-
-  What:   The current interactive restore is implemented with a tty
-          interface. It would be much nicer to be able to "see" the
-          list of files backed up in typical GUI tree format.
-          The same mechanism could also be used for creating 
-          ad-hoc backup FileSets (item 8).
-
-  Why:    Ease of use -- especially for the end user.
-
-  Notes:  Rather than implementing in Gtk, we probably should go directly
-          for a Browser implementation, even if doing so meant the
-          capability wouldn't be available until much later.  Not only
-          is there the question of Windows sites, most
-          Solaris/HP/IRIX, etc,  shops can't currently run Gtk programs
-          without installing lots of stuff admins are very wary about.
-          Real sysadmins will always use the command line anyway, and
-          the user who's doing an interactive restore or backup of his
-          own files will in most cases be on a Windows machine running
-          Exploder.
-
-Item 11:  New daemon communication protocol.
-
-  What:   The current daemon to daemon protocol is basically an ASCII
-          printf() and sending the buffer. On the receiving end, the
-          buffer is sscanf()ed to unpack it. The new scheme would
-          be a binary format that allows quick packing and unpacking
-          of any data type with named fields.
-
-  Why:    Using binary packing would be faster. Named fields will permit
-          error checking to ensure that what is sent is what the 
-          receiver really wants.
-
-  Notes:  These are internal improvements in the interest of the
-          long-term stability and evolution of the program.  On the one
-          hand, the sooner they're done, the less code we have to rip
-          up when the time comes to install them.  On the other hand, they
-          don't bring an immediately perceptible benefit to potential
-          users.  Item 10 and possibly item 11 should be deferred until Bacula
-          is well established with a growing user community more or
-          less happy with the feature set.  At that time, it will make a
-          good "next generation" upgrade in the interest of data
-          immortality.
-
-
 
 
 ======================================================
@@ -954,4 +853,19 @@ Done: (see kernsdone for more)
 === after 1.32c
 - John's Full save failed with 1.32c FD and 1.31 Dir no FD status,
   and no error message.
-
+- Add fd and st as Console keywords.
+- Recycling volume with a Slot requires an operator intervention:
+    rufus-dir: Start Backup JobId 18, Job=kernsave.2003-11-01_21.23.52
+    rufus-dir: Pruned 1 Job on Volume Vol01 from catalog.
+    rufus-dir: There are no Jobs associated with Volume Vol01. Marking it purged.
+    rufus-dir: Recycled volume "Vol01"
+    rufus-sd: Please mount Volume "Vol01" on Storage Device "DDS-4" for Job kernsave.2003-11-01_21.23.52
+    Use "mount" command to release Job.
+- Implement Dan's bacula script (email of 26 Oct).
+- Add JobName= to VerifyToCatalog so that all verifies can be done at the end.
+- Edit the Client/Storage name into authentication failure messages.
+- Fix packet too big problem. This is most likely a Windows TCP stack 
+  problem.
+- Implement ClientRunBeforeJob and ClientRunAfterJob.
+- Implement forward spacing block/file: position_device(bsr) --
+  just before read_block_from_device();
index 7cf9123a32bb1650d031644aac6fad41675b91a6..8d39622226adea5505452eefece36f9b56fb4ba7 100644 (file)
@@ -4,6 +4,9 @@
 #
 #  15 November 2001 -- Kern Sibbald
 #
+#  03 November 2003 corrections to the paths made by
+#      Kenneth ragnor at virtualsd dot net
+#
 #  for Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
 #
 
@@ -32,7 +35,7 @@ install-autostart-sd:
        @rm -f /etc/rc0.d/K20bacula-sd
        @rm -f /etc/rc1.d/S99bacula-sd
        @rm -f /etc/rc2.d/S99bacula-sd
-       @$(INSTALL_PROGRAM) -m 744 bacula-sd /etc/rc.d/init.d/bacula-sd
+       @$(INSTALL_PROGRAM) -m 744 bacula-sd /etc/init.d/bacula-sd
        # set symlinks for script at startup and shutdown
        @ln -f -s /etc/init.d/bacula-sd /etc/rc0.d/K20bacula-sd
        @ln -f -s /etc/init.d/bacula-sd /etc/rc1.d/S99bacula-sd
@@ -43,7 +46,7 @@ install-autostart-dir:
        @rm -f /etc/rc0.d/K20bacula-dir
        @rm -f /etc/rc1.d/S99bacula-dir
        @rm -f /etc/rc2.d/S99bacula-dir
-       @$(INSTALL_PROGRAM) -m 744 bacula-dir /etc/rc.d/init.d/bacula-dir
+       @$(INSTALL_PROGRAM) -m 744 bacula-dir /etc/init.d/bacula-dir
        # set symlinks for script at startup and shutdown
        @ln -f -s /etc/init.d/bacula-dir /etc/rc0.d/K20bacula-dir
        @ln -f -s /etc/init.d/bacula-dir /etc/rc1.d/S99bacula-dir
@@ -58,20 +61,20 @@ uninstall-autostart-fd:
        @rm -f /etc/rc0.d/K20bacula-fd
        @rm -f /etc/rc1.d/S99bacula-fd
        @rm -f /etc/rc2.d/S99bacula-fd
-       @rm -f /etc/rc.d/init.d/bacula-fd
+       @rm -f /etc/init.d/bacula-fd
 
 
 uninstall-autostart-sd:
        @rm -f /etc/rc0.d/K20bacula-sd
        @rm -f /etc/rc1.d/S99bacula-sd
        @rm -f /etc/rc2.d/S99bacula-sd
-       @rm -f /etc/rc.d/init.d/bacula-sd
+       @rm -f /etc/init.d/bacula-sd
 
 uninstall-autostart-dir:
        @rm -f /etc/rc0.d/K20bacula-dir
        @rm -f /etc/rc1.d/S99bacula-dir
        @rm -f /etc/rc2.d/S99bacula-dir
-       @rm -f /etc/rc.d/init.d/bacula-dir
+       @rm -f /etc/init.d/bacula-dir
 
 clean:
        @rm -f bacula-sd bacula-fd bacula-dir
index f530ba66a376804064e08d6688111b240ddbeb85..2952141c860be53b4c50094ae483b90bc2a50f43 100755 (executable)
 
 PSCMD="@PSCMD@"
 
+BACBIN=@sbindir@
+BACCFG=@sysconfdir@
+PIDDIR=@piddir@
+SUBSYSDIR=@subsysdir@
+
+DIR_PORT=9101
+FD_PORT=9102
+SD_PORT=9103
+
+DIR_USER=@dir_user@
+DIR_GROUP=@dir_group@
+FD_USER=@fd_user@
+FD_GROUP=@fd_group@
+SD_USER=@sd_user@
+SD_GROUP=@sd_group@
+
 # A function to stop a program.
 killproc() {
     RC=0
@@ -69,7 +85,7 @@ killproc() {
     fi
     # Remove pid file if any.
     if [ "$notset" = "1" ]; then
-       rm -f @piddir@/$base.$2.pid
+       rm -f ${PIDDIR}/$base.$2.pid
     fi
     return $RC
 }
@@ -87,8 +103,8 @@ pidofproc() {
     base=`basename $1`
 
     # First try PID file
-    if [ -f @piddir@/$base.$2.pid ] ; then
-       pid=`head -1 @piddir@/$base.$2.pid`
+    if [ -f ${PIDDIR}/$base.$2.pid ] ; then
+       pid=`head -1 ${PIDDIR}/$base.$2.pid`
        if [ "$pid" != "" ] ; then
            echo $pid
            return 0
@@ -138,15 +154,15 @@ status() {
    fi
 
     # Next try the PID files
-    if [ -f @piddir@/$base.$2.pid ] ; then
-       pid=`head -1 @piddir@/$base.$2.pid`
+    if [ -f ${PIDDIR}/$base.$2.pid ] ; then
+       pid=`head -1 ${PIDDIR}/$base.$2.pid`
        if [ "$pid" != "" ] ; then
            echo "$base dead but pid file exists"
            return 1
        fi
     fi
     # See if the subsys lock exists
-    if [ -f @subsysdir@/$base ] ; then
+    if [ -f ${SUBSYSDIR}/$base ] ; then
        echo "$base dead but subsys locked"
        return 2
     fi
@@ -165,33 +181,80 @@ failure() {
 
 case "$1" in
     start)
-       echo "Starting the Storage daemon"
-       @sbindir@/bacula-sd $2 -v -c @sysconfdir@/bacula-sd.conf
-       echo "Starting the File daemon"
-       @sbindir@/bacula-fd $2 -v -c @sysconfdir@/bacula-fd.conf
-       sleep 2
-       echo "Starting the Director daemon"
-       @sbindir@/bacula-dir $2 -v -c @sysconfdir@/bacula-dir.conf
+       [ -x ${BACBIN}/bacula-sd ] && {
+          echo "Starting the Storage daemon"
+          OPTIONS=''
+          if [ "${SD_USER}" != '' ]; then
+             OPTIONS="${OPTIONS} -u ${SD_USER}"
+          fi
+
+          if [ "${SD_GROUP}" != '' ]; then
+             OPTIONS="${OPTIONS} -g ${SD_GROUP}"
+          fi
+
+          ${BACBIN}/bacula-sd $2 ${OPTIONS} -v -c ${BACCFG}/bacula-sd.conf
+       }
+
+       [ -x ${BACBIN}/bacula-fd ] && {
+          echo "Starting the File daemon"
+          OPTIONS=''
+          if [ "${FD_USER}" != '' ]; then
+             OPTIONS="${OPTIONS} -u ${FD_USER}"
+          fi
+
+          if [ "${FD_GROUP}" != '' ]; then
+             OPTIONS="${OPTIONS} -g ${FD_GROUP}"
+          fi
+
+          ${BACBIN}/bacula-fd $2 ${OPTIONS} -v -c ${BACCFG}/bacula-fd.conf
+       }
+
+       [ -x ${BACBIN}/bacula-dir ] && { 
+                  sleep 2
+                  echo "Starting the Director daemon"
+          OPTIONS=''
+          if [ "${DIR_USER}" != '' ]; then
+             OPTIONS="${OPTIONS} -u ${DIR_USER}"
+          fi
+
+          if [ "${DIR_GROUP}" != '' ]; then
+             OPTIONS="${OPTIONS} -g ${DIR_GROUP}"
+          fi
+
+          ${BACBIN}/bacula-dir $2 ${OPTIONS} -v -c ${BACCFG}/bacula-dir.conf
+       }
        ;;
+
     stop)
-       echo "Stopping the File daemon"
-       killproc @sbindir@/bacula-fd @fd_port@
-       echo "Stopping the Storage daemon"
-       killproc @sbindir@/bacula-sd @sd_port@
-       echo "Stopping the Director daemon"
-       killproc @sbindir@/bacula-dir @dir_port@
+       [ -x ${BACBIN}/bacula-sd ] && {
+          echo "Stopping the Storage daemon"
+          killproc ${BACBIN}/bacula-sd ${SD_PORT}
+       }
+
+       [ -x ${BACBIN}/bacula-fd ] && {
+          echo "Stopping the File daemon"
+          killproc ${BACBIN}/bacula-fd ${FD_PORT}
+       }
+
+       [ -x ${BACBIN}/bacula-dir ] && {
+                 echo "Stopping the Director daemon"
+          killproc ${BACBIN}/bacula-dir ${DIR_PORT}
+       }
        echo
        ;;
+
     restart)
        $0 stop
        sleep 5
        $0 start
        ;;
+
     status)
-       status @sbindir@/bacula-sd @sd_port@
-       status @sbindir@/bacula-fd @fd_port@
-       status @sbindir@/bacula-dir @dir_port@
+       [ -x ${BACBIN}/bacula-sd  ] && status ${BACBIN}/bacula-sd  ${SD_PORT}
+       [ -x ${BACBIN}/bacula-fd  ] && status ${BACBIN}/bacula-fd  ${FD_PORT}
+       [ -x ${BACBIN}/bacula-dir ] && status ${BACBIN}/bacula-dir ${DIR_PORT}
        ;;
+
     *)
        echo "Usage: $0 {start|stop|restart|status}"
        exit 1
index a8a4a4bed0b4c25aa28c1e798d154a13e99bd845..a27c3270dfee06b1f0f03341a6ae50ad320caf44 100644 (file)
@@ -181,7 +181,7 @@ typedef float             float32_t;
 #define uintmax_t u_intmax_t
 
 /* Bacula time -- Unix time with microseconds */
-#define btime_t uint64_t
+#define btime_t int64_t
 /* Unix time (time_t) widened to 64 bits */
 #define utime_t int64_t
 
index 9ebd839f8017dab3d78acb6ac9713e750d88fd0e..c74a41a4bdba01e5f18b18d8de400620d4e4aab0 100644 (file)
@@ -190,7 +190,7 @@ void db_list_jobmedia_records(JCR *jcr, B_DB *mdb, uint32_t JobId,
 
    } else {
       if (JobId > 0) {                  /* do by JobId */
-         Mmsg(&mdb->cmd, "SELECT JobId,Media.VolumeName,FirstIndex,LastIndex"
+         Mmsg(&mdb->cmd, "SELECT JobId,Media.VolumeName,FirstIndex,LastIndex "
             "FROM JobMedia,Media WHERE Media.MediaId=JobMedia.MediaId "
             "AND JobMedia.JobId=%u", JobId);
       } else {
index f518bd2ced1063dbb20788025fa516260bed5f36..e424a4300f480319197d00b0b210d78439706bc3 100644 (file)
@@ -260,31 +260,31 @@ int main(int argc, char *argv[])
 
    while ((ch = getopt(argc, argv, "bc:d:r:st?")) != -1) {
       switch (ch) {
-         case 'c':                    /* configuration file */
-           if (configfile != NULL) {
-              free(configfile);
-           }
-           configfile = bstrdup(optarg);
-           break;
+      case 'c':                    /* configuration file */
+        if (configfile != NULL) {
+           free(configfile);
+        }
+        configfile = bstrdup(optarg);
+        break;
 
-         case 'd':
-           debug_level = atoi(optarg);
-           if (debug_level <= 0) {
-              debug_level = 1;
-           }
-           break;
+      case 'd':
+        debug_level = atoi(optarg);
+        if (debug_level <= 0) {
+           debug_level = 1;
+        }
+        break;
 
-         case 's':                    /* turn off signals */
-           no_signals = TRUE;
-           break;
+      case 's':                    /* turn off signals */
+        no_signals = TRUE;
+        break;
 
-         case 't':
-           test_config = TRUE;
-           break;
+      case 't':
+        test_config = TRUE;
+        break;
 
-         case '?':
-        default:
-           usage();
+      case '?':
+      default:
+        usage();
 
       }  
    }
@@ -377,6 +377,8 @@ try_again:
 
    Dmsg0(40, "Opened connection with Director daemon\n");
 
+   sendit(_("Enter a period to cancel a command.\n"));
+
    read_and_process_input(stdin, UA_sock);
 
    if (UA_sock) {
@@ -423,9 +425,8 @@ get_cmd(FILE *input, char *prompt, BSOCK *sock, int sec)
    if (!line) {
       exit(1);
    }
-   strcpy(sock->msg, line);
-   strip_trailing_junk(sock->msg);
-   sock->msglen = strlen(sock->msg);
+   strip_trailing_junk(line);
+   sock->msglen = pm_strcpy(&sock->msg, line);
    if (sock->msglen) {
       add_history(sock->msg);
    }
index 24b30db6953131f7ca041e8acdce0098b6d8fd32..9677a0e564207664a26d3537d4b49d694954d0cf 100644 (file)
@@ -116,10 +116,10 @@ static void print_findex(UAContext *ua, RBSR_FINDEX *fi)
    for ( ; fi; fi=fi->next) {
       if (fi->findex == fi->findex2) {
          bsendmsg(ua, "FileIndex=%d\n", fi->findex);
-//       Dmsg1(000, "FileIndex=%d\n", fi->findex);
+//       Dmsg1(100, "FileIndex=%d\n", fi->findex);
       } else {
          bsendmsg(ua, "FileIndex=%d-%d\n", fi->findex, fi->findex2);
-//       Dmsg2(000, "FileIndex=%d-%d\n", fi->findex, fi->findex2);
+//       Dmsg2(100, "FileIndex=%d-%d\n", fi->findex, fi->findex2);
       }
    }
 }
@@ -249,7 +249,7 @@ static void write_bsr(UAContext *ua, RBSR *bsr, FILE *fd)
             fprintf(fd, "VolBlock=%u-%u\n", bsr->VolParams[i].StartBlock,
                    bsr->VolParams[i].EndBlock);
         }
-//       Dmsg2(000, "bsr VolParam FI=%u LI=%u\n",
+//       Dmsg2(100, "bsr VolParam FI=%u LI=%u\n",
 //         bsr->VolParams[i].FirstIndex, bsr->VolParams[i].LastIndex);
 
         count = write_findex(ua, bsr->fi, bsr->VolParams[i].FirstIndex,
index a3341644c703d465961b331bbb222dbc97adf413..386aba318c3adff191c0661260fe11403c7b48c5 100644 (file)
@@ -65,7 +65,8 @@ extern int FDConnectTimeout;
 
 /*
  * Open connection with File daemon. 
- * Try connecting every 10 seconds, give up after 1 hour.
+ * Try connecting every retry_interval (default 10 sec), and
+ *   give up after max_retry_time (default 30 mins).
  */
 
 int connect_to_file_daemon(JCR *jcr, int retry_interval, int max_retry_time,
@@ -128,7 +129,13 @@ int connect_to_file_daemon(JCR *jcr, int retry_interval, int max_retry_time,
    return 1;
 }
 
-
+/*
+ * This subroutine edits the last job start time into a
+ *   "since=date/time" buffer that is returned in the  
+ *   variable since.  This is used for display purposes in
+ *   the job report.  The time in jcr->stime is later 
+ *   passed to tell the File daemon what to do.
+ */
 void get_level_since_time(JCR *jcr, char *since, int since_len)
 {
    /* Lookup the last
@@ -162,11 +169,14 @@ void get_level_since_time(JCR *jcr, char *since, int since_len)
 
 
 /*
- * Send level command for backup and estimate  
+ * Send level command to FD. 
+ * Used for backup jobs and estimate command.
  */
 int send_level_command(JCR *jcr) 
 {
    BSOCK   *fd = jcr->file_bsock;
+   utime_t stime;
+   char ed1[50];
    /* 
     * Send Level command to File daemon
     */
@@ -179,7 +189,12 @@ int send_level_command(JCR *jcr)
       break;
    case L_DIFFERENTIAL:
    case L_INCREMENTAL:
-      bnet_fsend(fd, levelcmd, "since ", jcr->stime, 0);
+//    bnet_fsend(fd, levelcmd, "since ", jcr->stime, 0); /* old code, deprecated */
+      stime = str_to_utime(jcr->stime);
+      bnet_fsend(fd, levelcmd, "since_utime ", edit_uint64(stime, ed1), 0);
+      while (bget_dirmsg(fd) >= 0) {  /* allow him to poll us to sync clocks */
+         Jmsg(jcr, M_INFO, 0, "%s\n", fd->msg);
+      }
       break;
    case L_SINCE:
    default:
index 34193975c0cf853c25d3a9ab98d5ed6df2e5c2d8..014c82b7e61f74af79af7d8545032014e9219fe9 100644 (file)
@@ -96,7 +96,7 @@ int bget_dirmsg(BSOCK *bs)
            break;
         case BNET_HEARTBEAT:
 //         encode_time(time(NULL), Job);
-//          Dmsg1(000, "%s got heartbeat.\n", Job);
+//          Dmsg1(100, "%s got heartbeat.\n", Job);
            break;
         case BNET_HB_RESPONSE:
            break;
@@ -105,6 +105,10 @@ int bget_dirmsg(BSOCK *bs)
             bnet_fsend(bs, "Status OK\n");
            bnet_sig(bs, BNET_EOD);
            break;
+        case BNET_BTIME:             /* send Bacula time */
+           char ed1[50];
+            bnet_fsend(bs, "btime %s\n", edit_uint64(get_current_btime(),ed1));
+           break;
         default:
             Emsg1(M_WARNING, 0, _("bget_dirmsg: unknown bnet signal %d\n"), bs->msglen);
            return n;
index 678e569d2b195e6703555cee25bbb6e0b9de4455..1a5b426a3a768ee48f711d4d1b9d86b4fe824d54 100644 (file)
@@ -95,23 +95,23 @@ static struct cmdstruct commands[] = {
  { N_("estimate"),   estimate_cmd,  _("performs FileSet estimate, listing gives full listing")},
  { N_("exit"),       quit_cmd,      _("exit = quit")},
  { N_("help"),       help_cmd,      _("print this command")},
- { N_("label"),      label_cmd,     _("label a tape")},
  { N_("list"),       list_cmd,      _("list [pools | jobs | jobtotals | media <pool> | files job=<nn>]; from catalog")},
+ { N_("label"),      label_cmd,     _("label a tape")},
  { N_("llist"),      llist_cmd,     _("full or long list like list command")},
  { N_("messages"),   messagescmd,   _("messages")},
  { N_("mount"),      mount_cmd,     _("mount <storage-name>")},
  { N_("prune"),      prunecmd,      _("prune expired records from catalog")},
  { N_("purge"),      purgecmd,      _("purge records from catalog")},
- { N_("query"),      querycmd,      _("query catalog")},
  { N_("quit"),       quit_cmd,      _("quit")},
+ { N_("query"),      querycmd,      _("query catalog")},
+ { N_("restore"),    restore_cmd,   _("restore files")},
  { N_("relabel"),    relabel_cmd,   _("relabel a tape")},
  { N_("release"),    release_cmd,   _("release <storage-name>")},
- { N_("restore"),    restore_cmd,   _("restore files")},
  { N_("run"),        run_cmd,       _("run <job-name>")},
+ { N_("status"),     status_cmd,    _("status [storage | client]=<name>")},
  { N_("setdebug"),   setdebug_cmd,  _("sets debug level")},
  { N_("show"),       show_cmd,      _("show (resource records) [jobs | pools | ... | all]")},
  { N_("sqlquery"),   sqlquerycmd,   _("use SQL to query catalog")}, 
- { N_("status"),     status_cmd,    _("status [storage | client]=<name>")},
  { N_("time"),       time_cmd,      _("print current time")},
  { N_("unmount"),    unmount_cmd,   _("unmount <storage-name>")},
  { N_("update"),     update_cmd,    _("update Volume or Pool")},
@@ -1245,7 +1245,8 @@ static int setdebug_cmd(UAContext *ua, char *cmd)
         debug_level = level;
         return 1;
       }
-      if (strcasecmp(ua->argk[i], _("client")) == 0) {
+      if (strcasecmp(ua->argk[i], _("client")) == 0 ||
+          strcasecmp(ua->argk[i], _("fd")) == 0) {
         client = NULL;
         if (ua->argv[i]) {
            client = (CLIENT *)GetResWithName(R_CLIENT, ua->argv[i]);
@@ -1262,7 +1263,8 @@ static int setdebug_cmd(UAContext *ua, char *cmd)
       }
 
       if (strcasecmp(ua->argk[i], _("store")) == 0 ||
-          strcasecmp(ua->argk[i], _("storage")) == 0) {
+          strcasecmp(ua->argk[i], _("storage")) == 0 ||
+          strcasecmp(ua->argk[i], _("sd")) == 0) {
         store = NULL;
         if (ua->argv[i]) {
            store = (STORE *)GetResWithName(R_STORAGE, ua->argv[i]);
@@ -1343,7 +1345,8 @@ static int estimate_cmd(UAContext *ua, char *cmd)
    char since[MAXSTRING];
 
    for (int i=1; i<ua->argc; i++) {
-      if (strcasecmp(ua->argk[i], _("client")) == 0) {
+      if (strcasecmp(ua->argk[i], _("client")) == 0 ||
+          strcasecmp(ua->argk[i], _("fd")) == 0) {
         if (ua->argv[i]) {
            client = (CLIENT *)GetResWithName(R_CLIENT, ua->argv[i]);
            continue;
@@ -1691,12 +1694,11 @@ static int help_cmd(UAContext *ua, char *cmd)
 {
    unsigned int i;
 
-/* usage(); */
    bsendmsg(ua, _("  Command    Description\n  =======    ===========\n"));
    for (i=0; i<comsize; i++) {
       bsendmsg(ua, _("  %-10s %s\n"), _(commands[i].key), _(commands[i].help));
    }
-   bsendmsg(ua, "\n");
+   bsendmsg(ua, _("\nWhen at a prompt, entering a period cancels the command.\n\n"));
    return 1;
 }
 
index f127a0badc15c8e0c4ff88c24b35c0ffb2232e87..b6e1c55c239e255bcd2af9de157ff43e5d24c454 100644 (file)
@@ -275,7 +275,7 @@ checkName:
       }
       if (ua->automount) {
         bstrncpy(dev_name, store->dev_name, sizeof(dev_name));
-         bsendmsg(ua, _("Requesting mount %s ...\n"), dev_name);
+         bsendmsg(ua, _("Requesting to mount %s ...\n"), dev_name);
         bash_spaces(dev_name);
          bnet_fsend(sd, "mount %s", dev_name);
         unbash_spaces(dev_name);
index 914a6fe5b62ef5efd28485b35875a78c8c1e2f36..4d4684be8631087a8212b222dac93463e7c7f1f7 100644 (file)
@@ -375,6 +375,7 @@ static int do_list_cmd(UAContext *ua, char *cmd, e_list_type llist)
         POOL *pool;
         RUN *run;
         time_t runtime;
+        bool found = false;
 
          i = find_arg_with_value(ua, "job");
         if (i <= 0) {
@@ -395,19 +396,32 @@ static int do_list_cmd(UAContext *ua, char *cmd, e_list_type llist)
            if (!complete_jcr_for_job(jcr, job, pool)) {
               return 1;
            }
-             
+          
            if (!find_next_volume_for_append(jcr, &mr, 0)) {
-               bsendmsg(ua, "Could not find next Volume\n");
-              db_close_database(jcr, jcr->db);
-              jcr->db = NULL;
+               bsendmsg(ua, _("Could not find next Volume.\n"));
+              if (jcr->db) {
+                 db_close_database(jcr, jcr->db);
+                 jcr->db = NULL;
+              }
               return 1;
            } else {
-               bsendmsg(ua, "The next Volume to be used by Job \"%s\" will be %s\n"
+               bsendmsg(ua, _("The next Volume to be used by Job \"%s\" will be %s\n")
                  job->hdr.name, mr.VolumeName);
+              found = true;
+           }
+           if (jcr->db) {
+              db_close_database(jcr, jcr->db);
+              jcr->db = NULL;
            }
         }
-        db_close_database(jcr, jcr->db);
-        jcr->db = NULL;
+        if (jcr->db) {
+           db_close_database(jcr, jcr->db);
+           jcr->db = NULL;
+        }
+        if (!found) {
+            bsendmsg(ua, _("Could not find next Volume.\n"));
+        }
+        return 1;
       } else {
          bsendmsg(ua, _("Unknown list keyword: %s\n"), NPRT(ua->argk[i]));
       }
@@ -535,8 +549,10 @@ int complete_jcr_for_job(JCR *jcr, JOB *job, POOL *pool)
       if (create_pool(jcr, jcr->db, jcr->pool, POOL_OP_CREATE) < 0) {
          Jmsg(jcr, M_FATAL, 0, _("Pool %s not in database. %s"), pr.Name, 
            db_strerror(jcr->db));
-        db_close_database(jcr, jcr->db);
-        jcr->db = NULL;
+        if (jcr->db) {
+           db_close_database(jcr, jcr->db);
+           jcr->db = NULL;
+        }
         return 0;
       } else {
          Jmsg(jcr, M_INFO, 0, _("Pool %s created in database.\n"), pr.Name);
index e2339e9ea11fcea0351b6566afe9559e19630e07..a42c8851fe1f4a9b6d135508393c31f556cc014d 100644 (file)
@@ -60,21 +60,23 @@ int run_cmd(UAContext *ua, char *cmd)
    FILESET *fileset = NULL;
    POOL *pool = NULL;
    static char *kw[] = {             /* command line arguments */
-      N_("job"),
-      N_("jobid"),
-      N_("client"),
-      N_("fileset"),
+      N_("job"),                      /*  Used in a switch() */
+      N_("jobid"),                    /* 1 */
+      N_("client"),                   /* 2 */
+      N_("fd"), 
+      N_("fileset"),                  /* 4 */
       N_("level"),
-      N_("storage"),
+      N_("storage"),                  /* 6 */
+      N_("sd"),                       /* 7 */
       N_("pool"), 
       N_("where"),
       N_("bootstrap"),
       N_("replace"),
       N_("when"),
       N_("priority"),
-      N_("yes"),          /* 12 -- if you change this change YES_POS too */
-      N_("run"),          /* 13 -- if you change this change RUN_POS too */
-      N_("verifyjob"),
+      N_("yes"),          /* 14 -- if you change this change YES_POS too */
+      N_("run"),          /* 15 -- if you change this change RUN_POS too */
+      N_("verifyjob"),                /* 16 */
       NULL};
 
 #define YES_POS 12
@@ -126,6 +128,7 @@ int run_cmd(UAContext *ua, char *cmd)
               found = true;
               break;
            case 2: /* client */
+           case 3: /* fd */
               if (client_name) {
                   bsendmsg(ua, _("Client specified twice.\n"));
                  return 1;
@@ -133,7 +136,7 @@ int run_cmd(UAContext *ua, char *cmd)
               client_name = ua->argv[i];
               found = true;
               break;
-           case 3: /* fileset */
+           case 4: /* fileset */
               if (fileset_name) {
                   bsendmsg(ua, _("FileSet specified twice.\n"));
                  return 1;
@@ -141,7 +144,7 @@ int run_cmd(UAContext *ua, char *cmd)
               fileset_name = ua->argv[i];
               found = true;
               break;
-           case 4: /* level */
+           case 5: /* level */
               if (level_name) {
                   bsendmsg(ua, _("Level specified twice.\n"));
                  return 1;
@@ -149,7 +152,8 @@ int run_cmd(UAContext *ua, char *cmd)
               level_name = ua->argv[i];
               found = true;
               break;
-           case 5: /* storage */
+           case 6: /* storage */
+           case 7: /* sd */
               if (store_name) {
                   bsendmsg(ua, _("Storage specified twice.\n"));
                  return 1;
@@ -157,7 +161,7 @@ int run_cmd(UAContext *ua, char *cmd)
               store_name = ua->argv[i];
               found = true;
               break;
-           case 6: /* pool */
+           case 8: /* pool */
               if (pool_name) {
                   bsendmsg(ua, _("Pool specified twice.\n"));
                  return 1;
@@ -165,7 +169,7 @@ int run_cmd(UAContext *ua, char *cmd)
               pool_name = ua->argv[i];
               found = true;
               break;
-           case 7: /* where */
+           case 9: /* where */
               if (where) {
                   bsendmsg(ua, _("Where specified twice.\n"));
                  return 1;
@@ -173,7 +177,7 @@ int run_cmd(UAContext *ua, char *cmd)
               where = ua->argv[i];
               found = true;
               break;
-           case 8: /* bootstrap */
+           case 10: /* bootstrap */
               if (bootstrap) {
                   bsendmsg(ua, _("Bootstrap specified twice.\n"));
                  return 1;
@@ -181,7 +185,7 @@ int run_cmd(UAContext *ua, char *cmd)
               bootstrap = ua->argv[i];
               found = true;
               break;
-           case 9: /* replace */
+           case 11: /* replace */
               if (replace) {
                   bsendmsg(ua, _("Replace specified twice.\n"));
                  return 1;
@@ -189,7 +193,7 @@ int run_cmd(UAContext *ua, char *cmd)
               replace = ua->argv[i];
               found = true;
               break;
-           case 10: /* When */
+           case 12: /* When */
               if (when) {
                   bsendmsg(ua, _("When specified twice.\n"));
                  return 1;
@@ -197,7 +201,7 @@ int run_cmd(UAContext *ua, char *cmd)
               when = ua->argv[i];
               found = true;
               break;
-           case 11:  /* Priority */
+           case 13:  /* Priority */
               if (Priority) {
                   bsendmsg(ua, _("Priority specified twice.\n"));
                  return 1;
@@ -208,11 +212,11 @@ int run_cmd(UAContext *ua, char *cmd)
                  Priority = 10;
               }
               break;
-           case 12: /* yes */
-           case 13: /* run */
+           case 14: /* yes */
+           case 15: /* run */
               found = true;
               break;
-           case 14: /* Verify Job */
+           case 16: /* Verify Job */
               if (verify_job_name) {
                   bsendmsg(ua, _("Verify Job specified twice.\n"));
                  return 1;
@@ -244,8 +248,6 @@ int run_cmd(UAContext *ua, char *cmd)
             
    Dmsg0(200, "Done scan.\n");
 
-
-
    if (job_name) {
       /* Find Job */
       job = (JOB *)GetResWithName(R_JOB, job_name);
index 3bef0d2bcf8368fe2f957bc199a9047b2e1a1c5f..0b1e1ef07e7309ebe95856a139af815ad45267c2 100644 (file)
@@ -278,7 +278,8 @@ CLIENT *get_client_resource(UAContext *ua)
    int i;
    
    for (i=1; i<ua->argc; i++) {
-      if (strcasecmp(ua->argk[i], _("client")) == 0 && ua->argv[i]) {
+      if ((strcasecmp(ua->argk[i], _("client")) == 0 ||
+           strcasecmp(ua->argk[i], _("fd")) == 0) && ua->argv[i]) {
         client = (CLIENT *)GetResWithName(R_CLIENT, ua->argv[i]);
         if (client) {
            return client;
@@ -311,7 +312,8 @@ int get_client_dbr(UAContext *ua, CLIENT_DBR *cr)
       bsendmsg(ua, _("Could not find Client %s: ERR=%s"), cr->Name, db_strerror(ua->db));
    }
    for (i=1; i<ua->argc; i++) {
-      if (strcasecmp(ua->argk[i], _("client")) == 0 && ua->argv[i]) {
+      if ((strcasecmp(ua->argk[i], _("client")) == 0 ||               
+           strcasecmp(ua->argk[i], _("fd")) == 0) && ua->argv[i]) {
         bstrncpy(cr->Name, ua->argv[i], sizeof(cr->Name));
         if (!db_get_client_record(ua->jcr, ua->db, cr)) {
             bsendmsg(ua, _("Could not find Client %s: ERR=%s"), ua->argv[i],
@@ -751,7 +753,8 @@ STORE *get_storage_resource(UAContext *ua, int use_default)
            break;
         }
       } else {
-         if (strcasecmp(ua->argk[i], _("storage")) == 0) {
+         if (strcasecmp(ua->argk[i], _("storage")) == 0 ||
+             strcasecmp(ua->argk[i], _("sd")) == 0) {
            store_name = ua->argv[i];
            break;
 
index f009332510d42410bca8328546315283fe9ac342..5fc210e2b0cb690f4b16e4964d5a69f8161ebb5d 100644 (file)
@@ -368,7 +368,7 @@ static void verify_cleanup(JCR *jcr, int TermCode)
    JobId_t JobId;
    char *Name;
 
-// Dmsg1(000, "Enter verify_cleanup() TermCod=%d\n", TermCode);
+// Dmsg1(100, "Enter verify_cleanup() TermCod=%d\n", TermCode);
 
    JobId = jcr->jr.JobId;
    set_jcr_job_status(jcr, TermCode);
index 58531ffd369c398a07ef9cce6d20fcd3b03bf77e..411a22f5e8933dbe7432eb836768cb91390d32bf 100644 (file)
@@ -590,7 +590,7 @@ static int bootstrap_cmd(JCR *jcr)
 static int level_cmd(JCR *jcr)
 {
    BSOCK *dir = jcr->dir_bsock;
-   POOLMEM *level;
+   POOLMEM *level, *buf = NULL;
    struct tm tm;
    time_t mtime;
    int mtime_only;
@@ -598,10 +598,7 @@ static int level_cmd(JCR *jcr)
    level = get_memory(dir->msglen+1);
    Dmsg1(110, "level_cmd: %s", dir->msg);
    if (sscanf(dir->msg, "level = %s ", level) != 1) {
-      pm_strcpy(&jcr->errmsg, dir->msg);
-      Jmsg1(jcr, M_FATAL, 0, _("Bad level command: %s\n"), jcr->errmsg);
-      free_memory(level);
-      return 0;
+      goto bail_out;
    }
    /* Base backup requested? */
    if (strcmp(level, "base") == 0) {
@@ -612,16 +609,14 @@ static int level_cmd(JCR *jcr)
    /* 
     * Backup requested since <date> <time>
     *  This form is also used for incremental and differential
+    *  This code is deprecated.  See since_utime for new code.
     */
    } else if (strcmp(level, "since") == 0) {
       jcr->JobLevel = L_SINCE;
       if (sscanf(dir->msg, "level = since %d-%d-%d %d:%d:%d mtime_only=%d", 
                 &tm.tm_year, &tm.tm_mon, &tm.tm_mday,
                 &tm.tm_hour, &tm.tm_min, &tm.tm_sec, &mtime_only) != 7) {
-        pm_strcpy(&jcr->errmsg, dir->msg);
-         Jmsg1(jcr, M_FATAL, 0, _("Bad scan of date/time: %s\n"), jcr->errmsg);
-        free_memory(level);
-        return 0;
+        goto bail_out;
       }
       tm.tm_year -= 1900;
       tm.tm_mon  -= 1;
@@ -632,13 +627,75 @@ static int level_cmd(JCR *jcr)
       jcr->incremental = 1;          /* set incremental or decremental backup */
       jcr->mtime = mtime;            /* set since time */
       jcr->mtime_only = mtime_only;   /* and what to compare */
+   /*
+    * We get his UTC since time, then sync the clocks and correct it
+    *  to agree with our clock.
+    */
+   } else if (strcmp(level, "since_utime") == 0) {
+      buf = get_memory(dir->msglen+1);
+      utime_t since_time, adj;
+      btime_t his_time, bt_start, rt=0, bt_adj=0;
+      jcr->JobLevel = L_SINCE;
+      if (sscanf(dir->msg, "level = since_utime %s mtime_only=%d", 
+                buf, &mtime_only) != 2) { 
+        goto bail_out;
+      }
+      since_time = str_to_uint64(buf); /* this is the since time */
+      char ed1[50], ed2[50];
+      /* 
+       * Sync clocks by polling him for the time. We take       
+       *   10 samples of his time throwing out the first two.
+       */
+      for (int i=0; i<10; i++) {
+        bt_start = get_current_btime();
+        bnet_sig(dir, BNET_BTIME);   /* poll for time */
+        if (bnet_recv(dir) <= 0) {   /* get response */
+           goto bail_out;
+        }
+         if (sscanf(dir->msg, "btime %s", buf) != 1) {
+           goto bail_out;
+        }
+        if (i < 2) {                 /* toss first two results */
+           continue;
+        }
+        his_time = str_to_uint64(buf);
+        rt = get_current_btime() - bt_start; /* compute round trip time */
+        bt_adj -= his_time - bt_start - rt/2;
+         Dmsg2(100, "rt=%s adj=%s\n", edit_uint64(rt, ed1), edit_uint64(bt_adj, ed2));
+      }
+
+      bt_adj = bt_adj / 8;           /* compute average time */
+      Dmsg2(100, "rt=%s adj=%s\n", edit_uint64(rt, ed1), edit_uint64(bt_adj, ed2));
+      adj = btime_to_utime(bt_adj);
+      since_time += adj;             /* adjust for clock difference */
+      if (adj != 0) {
+         Jmsg(jcr, M_INFO, 0, _("Since time adjusted by %d seconds.\n"), adj);
+      }
+      bnet_sig(dir, BNET_EOD);
+
+      Dmsg2(100, "adj = %d since_time=%d\n", (int)adj, (int)since_time);
+      jcr->incremental = 1;          /* set incremental or decremental backup */
+      jcr->mtime = since_time;       /* set since time */
+      jcr->mtime_only = mtime_only;   /* and what to compare */
    } else {
       Jmsg1(jcr, M_FATAL, 0, "Unknown backup level: %s\n", level);
       free_memory(level);
       return 0;
    }
    free_memory(level);
+   if (buf) {
+      free_memory(buf);
+   }
    return bnet_fsend(dir, OKlevel);
+
+bail_out:
+   pm_strcpy(&jcr->errmsg, dir->msg);
+   Jmsg1(jcr, M_FATAL, 0, _("Bad level command: %s\n"), jcr->errmsg);
+   free_memory(level);
+   if (buf) {
+      free_memory(buf);
+   }
+   return 0;
 }
 
 /*
index b7bb63320aa2f5c7229f3b6969f2d82146c0672f..eb4afe2686505c58dd66bf101d8377e1a246603c 100644 (file)
@@ -33,7 +33,9 @@
 static char rec_header[] = "rechdr %ld %ld %ld %ld %ld";
 
 /* Forward referenced functions */
+#ifdef HAVE_LIBZ
 static char *zlib_strerror(int stat);
+#endif
 
 #define RETRY 10                     /* retry wait time */
 
@@ -351,6 +353,7 @@ ok_out:
    }
 }         
 
+#ifdef HAVE_LIBZ
 /*
  * Convert ZLIB error code into an ASCII message
  */
@@ -376,3 +379,4 @@ static char *zlib_strerror(int stat)
       return "*none*";
    }
 }
+#endif
index 92aa2596c5fad3e5fe090291aa6329fc80ca5cbc..89910344b5af411f8dab1ba66cc1037fa47405c7 100644 (file)
@@ -66,6 +66,7 @@ struct BSOCK {
 #define BNET_HEARTBEAT   -6           /* Heartbeat Response requested */
 #define BNET_HB_RESPONSE -7           /* Only response permited to HB */
 #define BNET_PROMPT      -8           /* Prompt for UA */
+#define BNET_BTIME       -9           /* Send UTC btime */
 
 #define BNET_SETBUF_READ  1           /* Arg for bnet_set_buffer_size */
 #define BNET_SETBUF_WRITE 2           /* Arg for bnet_set_buffer_size */
index 10a2ff79251f12ea6eda347fc65c7164774d0aba..97e4fe829d133f52af381ec692959f8e89c9a117 100644 (file)
@@ -31,7 +31,7 @@
  *  it is being phased out. 
  *     
  *  Epoch is the base of Unix time in seconds (time_t, ...) 
- *     and is 1 Jan 1970 at 0:0
+ *     and is 1 Jan 1970 at 0:0 UTC
  *
  *  The major two times that should be left are:
  *     btime_t (64 bit integer in microseconds base Epoch)
@@ -92,28 +92,10 @@ utime_t str_to_utime(char *str)
    return (utime_t)ttime;
 }
 
-/* Deprecated. Do not use. */
-void get_current_time(struct date_time *dt)
-{
-   struct tm tm;
-   time_t now;
-
-   now = time(NULL);
-   gmtime_r(&now, &tm);
-   Dmsg6(200, "m=%d d=%d y=%d h=%d m=%d s=%d\n", tm.tm_mon+1, tm.tm_mday, tm.tm_year+1900,
-      tm.tm_hour, tm.tm_min, tm.tm_sec);
-   tm_encode(dt, &tm);
-#ifdef DEBUG
-   Dmsg2(200, "jday=%f jmin=%f\n", dt->julian_day_number, dt->julian_day_fraction);
-   tm_decode(dt, &tm);
-   Dmsg6(200, "m=%d d=%d y=%d h=%d m=%d s=%d\n", tm.tm_mon+1, tm.tm_mday, tm.tm_year+1900,
-      tm.tm_hour, tm.tm_min, tm.tm_sec);
-#endif
-}
 
 /*
  * Bacula's time (btime_t) is an unsigned 64 bit integer that contains
- *   the number of microseconds since Epoch Time (1 Jan 1970).
+ *   the number of microseconds since Epoch Time (1 Jan 1970) UTC.
  */
 
 btime_t get_current_btime()
@@ -135,10 +117,29 @@ time_t btime_to_unix(btime_t bt)
 /* Convert btime to utime */
 utime_t btime_to_utime(btime_t bt)
 {
-   return (utime_t)bt;
+   return (utime_t)(bt/1000000);
 }
 
 
+/* Deprecated. Do not use. */
+void get_current_time(struct date_time *dt)
+{
+   struct tm tm;
+   time_t now;
+
+   now = time(NULL);
+   gmtime_r(&now, &tm);
+   Dmsg6(200, "m=%d d=%d y=%d h=%d m=%d s=%d\n", tm.tm_mon+1, tm.tm_mday, tm.tm_year+1900,
+      tm.tm_hour, tm.tm_min, tm.tm_sec);
+   tm_encode(dt, &tm);
+#ifdef DEBUG
+   Dmsg2(200, "jday=%f jmin=%f\n", dt->julian_day_number, dt->julian_day_fraction);
+   tm_decode(dt, &tm);
+   Dmsg6(200, "m=%d d=%d y=%d h=%d m=%d s=%d\n", tm.tm_mon+1, tm.tm_mday, tm.tm_year+1900,
+      tm.tm_hour, tm.tm_min, tm.tm_sec);
+#endif
+}
+
 
 /*  date_encode  --  Encode civil date as a Julian day number. */
 
index b11e5a50a3ec28aa9622adfccd0cc477e079d40a..f82030702c319a7d969e9472ff5f216c9dd43c60 100644 (file)
@@ -242,7 +242,7 @@ uint64_t unserial_uint64(uint8_t * * const ptr)
 
 /*  unserial_btime  -- Unserialise a btime_t 64 bit integer.  */
 
-uint64_t unserial_btime(uint8_t * * const ptr)
+btime_t unserial_btime(uint8_t * * const ptr)
 {
     btime_t v;
 
index fb2434e6a260d5d6154919bfef059a061aa66d4a..0f03113fecfe1431764124a25849bb1fd0c33246 100644 (file)
@@ -115,6 +115,7 @@ char *encode_time(time_t time, char *buf)
 
 /*
  * Concatenate a string (str) onto a pool memory buffer pm
+ *   Returns: length of concatenated string
  */
 int pm_strcat(POOLMEM **pm, char *str)
 {
@@ -129,6 +130,7 @@ int pm_strcat(POOLMEM **pm, char *str)
 
 /*
  * Copy a string (str) into a pool memory buffer pm
+ *   Returns: length of string copied
  */
 int pm_strcpy(POOLMEM **pm, char *str)
 {
index 762c138d4d7d026717535d4ea2dbf9174a7b3087..392640505c6c631f133089d316c4836cc5126532 100644 (file)
@@ -286,11 +286,13 @@ int dir_ask_sysop_to_mount_next_volume(JCR *jcr, DEVICE *dev)
         jstat = JS_WaitMount;
         /*
          * If we have a valid volume name and we are not
-         * removable media, return now, otherwise wait
-         * for the operator to mount the media.
+         *   removable media, return now, or if we have a
+         *   Slot for an autochanger, otherwise wait
+         *   for the operator to mount the media.
          */
-        if (jcr->VolumeName[0] && !dev_cap(dev, CAP_REM) && dev_cap(dev, CAP_LABEL)) {
-            Dmsg0(190, "Return 1 from mount without wait.\n");
+        if ((jcr->VolumeName[0] && !dev_cap(dev, CAP_REM) && dev_cap(dev, CAP_LABEL)) ||
+            (jcr->VolumeName[0] && jcr->VolCatInfo.Slot)) {
+            Dmsg0(100, "Return 1 from mount without wait.\n");
            return 1;
         }
         Jmsg(jcr, M_MOUNT, 0, _(
index 78fe85ef638f30f7dc327e4fa4adc54a119f4ea6..997020c89c1c503bd76cfb26e08a49ed333049bd 100644 (file)
@@ -325,7 +325,7 @@ open_dev(DEVICE *dev, char *VolName, int mode)
 #undef rewind_dev
 int _rewind_dev(char *file, int line, DEVICE *dev)
 {
-   Dmsg2(000, "rewind_dev called from %s:%d\n", file, line);
+   Dmsg2(100, "rewind_dev called from %s:%d\n", file, line);
    return rewind_dev(dev);
 }
 #endif
@@ -412,7 +412,7 @@ eod_dev(DEVICE *dev)
    }
    if (!(dev->state & ST_TAPE)) {
       pos = lseek(dev->fd, (off_t)0, SEEK_END);
-//    Dmsg1(000, "====== Seek to %lld\n", pos);
+//    Dmsg1(100, "====== Seek to %lld\n", pos);
       if (pos >= 0) {
         update_pos_dev(dev);
         dev->state |= ST_EOT;
index 49bf8886711c45ab0160d945f155ab369d7eea07..4e456d84e50d144c37a7799cc0a36dbf0bc59342 100644 (file)
@@ -451,7 +451,7 @@ static int read_label(JCR *jcr, DEVICE *dev)
       stat = 1;
       break;
    default:
-      bnet_fsend(dir, _("3902 Cannot mount Volume on Storage Device \"%s\" because:\n%s\n"),
+      bnet_fsend(dir, _("3902 Cannot mount Volume on Storage Device \"%s\" because:\n%s"),
         dev->dev_name, jcr->errmsg);
       stat = 0;
       break;
@@ -487,17 +487,17 @@ static int mount_cmd(JCR *jcr)
       }
       UnlockRes();
       if (found) {
+        DEV_BLOCK *block;
         jcr->device = device;
         dev = device->dev;
         P(dev->mutex);               /* Use P to avoid indefinite block */
         switch (dev->dev_blocked) {         /* device blocked? */
-           DEV_BLOCK *block;
         case BST_WAITING_FOR_SYSOP:
            /* Someone is waiting, wake him */
             Dmsg0(100, "Waiting for mount. Attempting to wake thread\n");
            dev->dev_blocked = BST_MOUNT;
-           pthread_cond_signal(&dev->wait_next_vol);
             bnet_fsend(dir, "3001 OK mount. Device=%s\n", dev->dev_name);
+           pthread_cond_signal(&dev->wait_next_vol);
            break;
 
         case BST_UNMOUNTED_WAITING_FOR_SYSOP:
@@ -518,7 +518,6 @@ static int mount_cmd(JCR *jcr)
            } else {
                Dmsg0(100, "Unmounted waiting for mount. Attempting to wake thread\n");
               dev->dev_blocked = BST_MOUNT;
-              pthread_cond_signal(&dev->wait_next_vol);
            }
            if (dev->state & ST_LABEL) {
                bnet_fsend(dir, _("3001 Device %s is mounted with Volume \"%s\"\n"), 
@@ -528,6 +527,7 @@ static int mount_cmd(JCR *jcr)
                                  "If this is not a blank tape, try unmounting and remounting the Volume.\n"),
                          dev->dev_name);
            }
+           pthread_cond_signal(&dev->wait_next_vol);
            break;
 
         case BST_DOING_ACQUIRE:
index 57902162b0a57c39618fbc7214c9777ca530d2b4..6c54e6d835bff105fada120bd7678bcd6df2089c 100644 (file)
@@ -142,11 +142,6 @@ int job_cmd(JCR *jcr)
    /*
     * Pass back an authorization key for the File daemon
     */
-#ifdef Old_way_not_so_good
-   gettimeofday(&tv, &tz);
-   srandom(tv.tv_usec + tv.tv_sec);
-   sprintf(auth_key, "%ld", (long)random());
-#endif
    make_session_key(auth_key, NULL, 1);
    bnet_fsend(dir, OKjob, jcr->VolSessionId, jcr->VolSessionTime, auth_key);
    Dmsg1(110, ">dird: %s", dir->msg);
@@ -170,7 +165,7 @@ int job_cmd(JCR *jcr)
    timeout.tv_sec = tv.tv_sec + 30 * 60;       /* wait 30 minutes */
 
 
-   Dmsg1(200, "%s waiting on job_start_wait\n", jcr->Job);
+   Dmsg1(100, "%s waiting on job_start_wait\n", jcr->Job);
    /* Wait for the File daemon to contact us to start the Job,
     *  when he does, we will be released, unless the 30 minutes
     *  expires.
@@ -187,6 +182,7 @@ int job_cmd(JCR *jcr)
    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);
       run_job(jcr);                  /* Run the job */
    }
    return 0;
index 3b419860dd9d7889104c0d95c63e4b6ae2bd0dd0..46368bb8be8a882f8ed1eb16ef28e604fb1da166 100644 (file)
@@ -73,9 +73,12 @@ mount_next_vol:
    /* 
     * Get Director's idea of what tape we should have mounted. 
     */
-   if (!dir_find_next_appendable_volume(jcr) &&
-       !dir_ask_sysop_to_mount_next_volume(jcr, dev)) {
-      return 0;
+   Dmsg0(100, "Before dir_find_next\n");
+   if (!dir_find_next_appendable_volume(jcr)) {
+       Dmsg0(100, "not dir_find_next\n");
+       if (!dir_ask_sysop_to_mount_next_volume(jcr, dev)) {
+        return 0;
+       }
    }
    Dmsg2(100, "After find_next_append. Vol=%s Slot=%d\n",
         jcr->VolCatInfo.VolCatName, jcr->VolCatInfo.Slot);
@@ -94,7 +97,6 @@ mount_next_vol:
     *
     */
 
-   Dmsg0(100, "Enter ready_dev_for_append\n");
 
    dev->state &= ~(ST_APPEND|ST_READ|ST_EOT|ST_WEOT|ST_EOF);
 
@@ -112,10 +114,9 @@ mount_next_vol:
       if (autochanger || (!release && dev_is_tape(dev) && dev_cap(dev, CAP_AUTOMOUNT))) {
          ask = false;                 /* don't ask SYSOP this time */
       }
-
+      Dmsg2(100, "Ask=%d autochanger=%d\n", ask, autochanger);
       release = 1;                    /* release next time if we "recurse" */
 
-// ask_again:
       if (ask && !dir_ask_sysop_to_mount_next_volume(jcr, dev)) {
          Dmsg0(100, "Error return ask_sysop ...\n");
         return 0;              /* error return */
index b79081afbf1b149acf8170d90363cd09938dd350..8ace8a7a817824eeec151ea269c73a683861078d 100644 (file)
@@ -51,12 +51,12 @@ static void usage()
 "       -           read pattern(s) from stdin\n"
 "       -?          print this message.\n"
 "\n"
-"Patterns are file inclusion -- normally directories.\n"
+"Patterns are used for file inclusion -- normally directories.\n"
 "Debug level >= 1 prints each file found.\n"
 "Debug level >= 10 prints path/file for catalog.\n"
-"Errors always printed.\n"
-"Files/paths truncated is number with len > 255.\n"
-"Truncation is only in catalog.\n"
+"Errors are always printed.\n"
+"Files/paths truncated is the number of files/paths with len > 255.\n"
+"Truncation is only in the catalog.\n"
 "\n"));
 
    exit(1);
index 587af5a2a45466256bfe1268a49e2a1d5811ed46..12cbc3be1a82d9e97245ecf57ec49c5d80935347 100644 (file)
@@ -1,9 +1,9 @@
 /* */
 #undef  VERSION
-#define VERSION "1.32d"
+#define VERSION "1.33"
 #define VSTRING "1"
-#define BDATE   "02 Nov 2003"
-#define LSMDATE "02Nov03"
+#define BDATE   "06 Nov 2003"
+#define LSMDATE "06Nov03"
 
 /* Debug flags */
 #undef  DEBUG