From 790890265aebc2a7f7f43610df5eef29c5bbea29 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 7 Nov 2003 10:29:25 +0000 Subject: [PATCH] Fix: clock diff, Dan's patch, Nic's patch, segfault git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@798 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/autoconf/configure.in | 86 +++++++- bacula/kernstodo | 298 ++++++++++----------------- bacula/platforms/solaris/Makefile.in | 13 +- bacula/scripts/bacula.in | 107 ++++++++-- bacula/src/bc_types.h | 2 +- bacula/src/cats/sql_list.c | 2 +- bacula/src/console/console.c | 49 ++--- bacula/src/dird/bsr.c | 6 +- bacula/src/dird/fd_cmds.c | 23 ++- bacula/src/dird/getmsg.c | 6 +- bacula/src/dird/ua_cmds.c | 20 +- bacula/src/dird/ua_label.c | 2 +- bacula/src/dird/ua_output.c | 34 ++- bacula/src/dird/ua_run.c | 46 +++-- bacula/src/dird/ua_select.c | 9 +- bacula/src/dird/verify.c | 2 +- bacula/src/filed/job.c | 75 ++++++- bacula/src/filed/restore.c | 4 + bacula/src/lib/bsock.h | 1 + bacula/src/lib/btime.c | 43 ++-- bacula/src/lib/serial.c | 2 +- bacula/src/lib/util.c | 2 + bacula/src/stored/askdir.c | 10 +- bacula/src/stored/dev.c | 4 +- bacula/src/stored/dircmd.c | 8 +- bacula/src/stored/job.c | 8 +- bacula/src/stored/mount.c | 13 +- bacula/src/tools/testfind.c | 8 +- bacula/src/version.h | 6 +- 29 files changed, 528 insertions(+), 361 deletions(-) diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index 8eca027d8e..54c3256ba0 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -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 diff --git a/bacula/kernstodo b/bacula/kernstodo index 39bbdee702..34093ca3d3 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -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(); diff --git a/bacula/platforms/solaris/Makefile.in b/bacula/platforms/solaris/Makefile.in index 7cf9123a32..8d39622226 100644 --- a/bacula/platforms/solaris/Makefile.in +++ b/bacula/platforms/solaris/Makefile.in @@ -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 diff --git a/bacula/scripts/bacula.in b/bacula/scripts/bacula.in index f530ba66a3..2952141c86 100755 --- a/bacula/scripts/bacula.in +++ b/bacula/scripts/bacula.in @@ -11,6 +11,22 @@ 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 diff --git a/bacula/src/bc_types.h b/bacula/src/bc_types.h index a8a4a4bed0..a27c3270df 100644 --- a/bacula/src/bc_types.h +++ b/bacula/src/bc_types.h @@ -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 diff --git a/bacula/src/cats/sql_list.c b/bacula/src/cats/sql_list.c index 9ebd839f80..c74a41a4bd 100644 --- a/bacula/src/cats/sql_list.c +++ b/bacula/src/cats/sql_list.c @@ -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 { diff --git a/bacula/src/console/console.c b/bacula/src/console/console.c index f518bd2ced..e424a4300f 100644 --- a/bacula/src/console/console.c +++ b/bacula/src/console/console.c @@ -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); } diff --git a/bacula/src/dird/bsr.c b/bacula/src/dird/bsr.c index 24b30db695..9677a0e564 100644 --- a/bacula/src/dird/bsr.c +++ b/bacula/src/dird/bsr.c @@ -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, diff --git a/bacula/src/dird/fd_cmds.c b/bacula/src/dird/fd_cmds.c index a3341644c7..386aba318c 100644 --- a/bacula/src/dird/fd_cmds.c +++ b/bacula/src/dird/fd_cmds.c @@ -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: diff --git a/bacula/src/dird/getmsg.c b/bacula/src/dird/getmsg.c index 34193975c0..014c82b7e6 100644 --- a/bacula/src/dird/getmsg.c +++ b/bacula/src/dird/getmsg.c @@ -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; diff --git a/bacula/src/dird/ua_cmds.c b/bacula/src/dird/ua_cmds.c index 678e569d2b..1a5b426a3a 100644 --- a/bacula/src/dird/ua_cmds.c +++ b/bacula/src/dird/ua_cmds.c @@ -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 | files job=]; 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 ")}, { 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 ")}, - { N_("restore"), restore_cmd, _("restore files")}, { N_("run"), run_cmd, _("run ")}, + { N_("status"), status_cmd, _("status [storage | client]=")}, { 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]=")}, { N_("time"), time_cmd, _("print current time")}, { N_("unmount"), unmount_cmd, _("unmount ")}, { 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; iargc; 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; iautomount) { 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); diff --git a/bacula/src/dird/ua_output.c b/bacula/src/dird/ua_output.c index 914a6fe5b6..4d4684be86 100644 --- a/bacula/src/dird/ua_output.c +++ b/bacula/src/dird/ua_output.c @@ -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); diff --git a/bacula/src/dird/ua_run.c b/bacula/src/dird/ua_run.c index e2339e9ea1..a42c8851fe 100644 --- a/bacula/src/dird/ua_run.c +++ b/bacula/src/dird/ua_run.c @@ -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); diff --git a/bacula/src/dird/ua_select.c b/bacula/src/dird/ua_select.c index 3bef0d2bcf..0b1e1ef07e 100644 --- a/bacula/src/dird/ua_select.c +++ b/bacula/src/dird/ua_select.c @@ -278,7 +278,8 @@ CLIENT *get_client_resource(UAContext *ua) int i; for (i=1; iargc; 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; iargc; 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; diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index f009332510..5fc210e2b0 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -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); diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index 58531ffd36..411a22f5e8 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -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