in ,

A backup rotation filter for your Unix shell, Hacker News

    

      

            prunef         

Takes an unsorted list of backup names and returns a list of backups for deletion. The backup rotation rules are given via command line args. The backup names need to contain the time and a date (1) like format specifier is required to parse those.

The following example will make prunef to keep 7 daily, 4 weekly and 6 monthly backups.

   prunef --keep-daily  7            --keep-weekly  4            --keep-monthly  6             "example.org_% Y-% m-% d_% H-% M-% S.tar.gz"  

By default it will parse the dates using the local timezone. The algorithm uses UTC internaly. If the entries are created in UTC use the - utc

flag.

To list backups that will should be kept use the - invert

option .

            Backup slots         

The algorithm works by creating timestamp slots according to the rules given. The first slot is always now. A slot ends where the next timestamp begins. The slots are filled with entries, that are between a slot timestamp and the following timestamp. If an entry exists, it will be replaced if another matches the slot and is more recent.

Slots may not be filled, if there is no entry matching the timestamps. That means you will only fill all slots, if the backups are created with lower intervals than the lowest slot interval. If for example a backup is created every 2 hours and - keep-hourly 4 is provided, only 2 backups will be kept.

If no arguments are given, only one slot with now as timestamp will be created. Hence the latest backup will never be returned to be pruned.

            Contributing         

You can send patches to the mailing list or use the GitHub Mirror

.     

  

Read More

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *

GIPHY App Key not set. Please check settings

Republican mega-donor buys stake in Twitter and seeks to oust Jack Dorsey – report, hacker news

Republican mega-donor buys stake in Twitter and seeks to oust Jack Dorsey – report, hacker news

Coronavirus outbreak updates: Pakistan confirms 2 more coronavirus cases, bringing total to 4 – India Today, Indiatoday.in

Coronavirus outbreak updates: Pakistan confirms 2 more coronavirus cases, bringing total to 4 – India Today, Indiatoday.in