|
From: Stefan G. W. <li...@xu...> - 2025-03-14 10:03:52
|
Am 14.03.25 um 07:48 schrieb Stefan G. Weichinger via Bacula-users:
>> I use an 8-slot autoloader, I added a little bit of SQL to the query
>> file and just run that, it lists my tapes from last-used to most recent.
>> I grab the three oldest, move them to the Scratch pool, purge them,
>> and replace the three oldest in the autoloader with them.
>>
>> NOTE: This is for Postgres, YMMV:
>> # 22
>> :List volumes in Order of LastWritten
>> SELECT 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;
>>
>> I wrote it about 6 years ago, previously I'd been looking at the
>> output of "list media" and working out what was oldest.
>
> oh, looks promising, thanks for sharing! I will test that later today
> when I have to select tapes for the weekend.
(how) do you run it in a cronjob or so?
For a first test I ran it within bconsole. I will google my way to
scripting this ...
looks promising! I will adjust it to my needs asap.
thanks!
|