Re: needed tapes

"Gary R. Schmidt" <[email protected]>
Newsgroups gmane.comp.bacula.user
Message-ID <[email protected]>
On 19/3/25 21:36, Stefan G. Weichinger via Bacula-users wrote:
> ok, I now have:
> 
> # cat bacula_tapes.sh
> #!/bin/bash
> 
> echo -e "sql\nSELECT Media.MediaId, Media.VolumeName, Media.PoolId, 
> Pool.Name AS Pool, Media.Slot,\
>          Media.Slot <> 0 AS InChanger, Media.FirstWritten, 
> Media.LastWritten, Media.VolStatus, \
>          GREATEST(0, (extract('epoch' from LastWritten + 
> Media.VolRetention * interval '1second' - NOW())::bigint)) as ExpiresIn, \
>          Media.VolBytes \
>      FROM Media \
>      INNER JOIN Pool \
>          ON Media.PoolId = Pool.PoolId \
>      ORDER BY Media.LastWritten;\n\nquit\n" | bconsole
> 
> 
> Works. I am not compentent with these SQL-queries, I try to filter out 
> only tapes for a specific Pool now.
> 
> Adding
> 
> "WHERE Media.Pool = Daily \"  after the FROM line for example doesn't work.
> 
> Would you help me out once more? I assume the WHERE conflicts with the 
> JOIN or so ...
> 
> thanks a lot!

Look up what the PoolId for "Daily" is from Pool and use Media.PoolId = 
Whatever_That_Is rather than the non-existent (in my version of bacula) 
Media.Pool.

	Cheers,
		Gary	B-)


_______________________________________________
Bacula-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.