----- "Erik P. Olsen" <epod...@gmail.com> wrote:
> On 14/12/09 15:39, Erik P. Olsen wrote:
> > Is it possible to launch a bacula command (like umount) in the
> > RunBeforeJob script? If yes, how?
> >
> Oh, I should have mentioned that the RunBeforeJob script will run on
> linux, fedora 12 more specifically.


Hi Erik. Yes this is possible.

What I usually do is write a short script that simply pipes a command (or 
several commands) to bconsole, then I schedule Bacula to run that script as a 
"runBefore" script in an "Admin" type job.

Here's an example that I use to update the slots on a client's site where I can 
not be 100% sure what tapes they will insert or remove from the autoloader. 
This job runs nightly just shortly before the normal backup jobs run:


# ----------------
# Update Slots Job
# ----------------
Job {
  Name = UpdateSlots
  Client = bacula-fd
  Type = Admin
  FileSet = Default
  Schedule = UpdateSlots
  Messages = Standard
  Storage = LTO
  Pool = Default
  Priority = 5
  
  RunScript {
    RunsWhen = Before
    RunsOnClient = no
    Fail Job On Error = no
    Command = "/usr/local/sbin/runbefore-updateslots.sh"
  }
}

# -----------
# UpdateSlots
# -----------
Schedule {
  Name = UpdateSlots
  Run = mon-sun at 22:50
}



File: /usr/local/sbin/runbefore-updateslots.sh

--[snip]--
#!/bin/bash
BC="/usr/sbin/bconsole"
CONF="/etc/bacula/bconsole.conf"
STORAGE="DLT-V4"

$BC -c $CONF << EOF
update slots storage=$STORAGE
quit
EOF
--[snip]--


Hope this helps

--
Bill Arlofski
Reverse Polarity, LLC

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to