|
From: Gary R. S. <gr...@mc...> - 2025-03-19 10:52:49
|
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-)
|