On Wed, 17 Oct 2007, Pascal Charest wrote:

> I am currently using bconsole for all my operations and would like 
> to know if there is anyway I could script command from outside the 
> bacula console.

Below my .sig is the script I use to print hard copies of the jobs 
found on tapes that go into secure storage. My thinking is that if 
everything but the tapes gets destroyed, I'd at least have an inkling 
of which tapes to use first.

-- 
Paul Heinlein <> [EMAIL PROTECTED] <> http://www.madboa.com/


#!/bin/bash
#
# Script for printing list of jobs on any given Bacula volume.
#
# ======================================================================

VOL="$1"
TYPE=""
PFX="/usr/local/bacula"

case "$VOL" in
   '')
     cat <<__eom__ >/dev/stderr

This script sends to the printer a list of jobs stored on any given
bacula tape volume. The printed output should be stored in the tape case
when a volume is moved to the safe or off-site.

Usage: $(basename $0) volume-name

Example: $(basename $0) 000006L3

__eom__
     exit 1
     ;;
   *)
     # pools are named daily-tape, weekly-tape, and monthly-tape, so
     # the $TYPE of job is discerned by stripping '-tape' from the
     # end of the Pool.Name.
     SQL="
       select Pool.Name from Media, Pool
       where  Media.VolumeName = '$VOL'
       and  Media.PoolId = Pool.PoolId;"
     TYPE=$(echo "$SQL" | mysql bacula | tail -n1 | sed s/-tape$//)
     ;;
esac

test -n "$TYPE" || exit 1

${PFX}/sbin/bconsole -c /etc/bacula/bconsole.conf \
                    <<__eof__ | a2ps --columns=1 --chars-per-line=132 
@#
@# *****************************************************************
@# Listing $TYPE jobs on volume $VOL
@# *****************************************************************
@#
@output /dev/null
@# the initial output and menu just clutter things up
query
14
@output
$VOL
quit
__eof__

###
### eof
###

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to