Hi,

Maybe something like this:

#!/bin/bash

VOLUME=$1
DBHOST=localhost
DATABASE=bacula
USER=""
PASSWORD=""

JOBS=($(mysql --host=$DBHOST --database=$DATABASE --user=$USER
--password=$PASSWORD -N -e "SELECT DISTINCT Job.JobId as JobId,Job.Name as
Name,Job.StartTime as StartTime, Job.Type as Type,Job.Level as
Level,Job.JobFiles as Files, Job.JobBytes as Bytes,Job.JobStatus as Status
FROM Media,JobMedia,Job WHERE Media.VolumeName=\"$VOLUME\" AND
Media.MediaId=JobMedia.MediaId AND JobMedia.JobId=Job.JobId ORDER by
Job.StartTime"))
COLS=9
NUMJOBS=$((${#JOBS[*]}/COLS))

printf "Jobs for volume %s\n" $VOLUME > test.txt

for ((i=0;i<NUMJOBS;i++)) do
  printf "%s %s %s %s %s %s %s %s %s\n" ${JOBS[i*COLS]} ${JOBS[i*COLS+1]}
 ${JOBS[i*COLS+2]} ${JOBS[i*COLS+3]} ${JOBS[i*COLS+4]} ${JOBS[i*COLS+5]}
${JOBS[i*COLS+6]} ${JOBS[i*COLS+7]} ${JOBS[i*COLS+8]} >> test.txt
done

for ((i=0;i<NUMJOBS;i++)) do
  printf "\nFiles for Job %s\n" ${JOBS[i*COLS]} >> test.txt
  mysql --host=$DBHOST --database=$DATABASE --user=$USER
--password=$PASSWORD -N -e "SELECT Path.Path,Filename.Name FROM
File,Filename,Path WHERE File.JobId=\"${JOBS[i*COLS]}\" AND
Filename.FilenameId=File.FilenameId AND Path.PathId=File.PathId ORDER BY
Path.Path,Filename.Name" >> test.txt
done

Best regards,
Ana

On Wed, Apr 22, 2015 at 1:07 PM, bdam <bacula-fo...@backupcentral.com>
wrote:

> One final question about this - when i issue the query command from the
> console this way, is there a way to either pagenate the results or send
> them to a file so I can browse them? These are 3 months of CCTV from
> multiple cameras running 24/7 in 20 minute sections, so there are rather a
> lot of files shown!!!
>
> +----------------------------------------------------------------------
> |This was sent by bill.dam...@yahoo.com via Backup Central.
> |Forward SPAM to ab...@backupcentral.com.
> +----------------------------------------------------------------------
>
>
>
>
> ------------------------------------------------------------------------------
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live
> exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual-
> event?utm_
> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> _______________________________________________
> Bacula-users mailing list
> Bacula-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bacula-users
>
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to