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!




_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to