[Koha] Autodelete backups older than 5days

asakovich at hmcpl.org asakovich at hmcpl.org
Tue Dec 8 06:07:09 NZDT 2020


We do something similar — these 2 lines move the latest backup to our Backup volume, then prune that directory to only hold the last 6 months (182 days) of backups:

mv ./huntsville*.sql.gz /Backup
find /Backup/ -name "huntsville*.sql.gz" -type f -mtime +182 -delete

Aaron
--
Aaron Sakovich
Internet and Technology Services Manager

Huntsville-Madison County Public Library
915 Monroe Street | Huntsville, Alabama 35801 | https://hmcpl.org/




> On Dec 5, 2020, at 06:35, Tomas Cohen Arazi <tomascohen at gmail.com> wrote:
> 
> Something like:
> 
> find /path/to/files* -mtime +5 -exec rm {} \;
> 
> 
> On Sat, Dec 5, 2020, 09:32 muiru james <muirunyeri at gmail.com> wrote:
> 
>> Hello
>> 
>> Thank you for finding time to reply to my question.
>> I have created a cron that runs at 1800hrs and executes a shell script i
>> have named badh.sh containg the syntax for doing a manual sql dump
>> (mysqldump -uroot -p**** /) which saves in the folder dropbox in the home
>> directory. This dropbox folder synchronises and uploads the new archives to
>> the cloud. I want to automatically delete the old backup files older than
>> five days thru a script which I'll add to the bash.sh script file.
>> 
>> Regards
>> 
>> On Sat, Dec 5, 2020, 14:18 Mark Alexander <marka at pobox.com> wrote:
>> 
>>> Excerpts from muiru james's message of 2020-12-05 13:10:56 +0300:
>>>> I have my Koha instance backing up automatically to dropbox through a
>>> bash
>>>> script. I need to automatically delete archives older than 5 days. How
>>> do I
>>>> do it?
>>> 
>>> If you're using rsync to send the backups from your Koha server to
>>> dropbox, you can use the --delete option.  That will delete files on
>>> dropbox that are not present on the Koha server.  I don't use use
>> dropbox,
>>> but I do something like this to copy backups to my home machine:
>>> 
>>> rsync -av --delete root at koha.example.com:/var/spool/koha/INSTANCENAME/
>>> koha-backups
>>> 
>>> --
>>> Let's organize this thing and take all
>>> the fun out of it. --Ashleigh Brilliant
>>> _______________________________________________
>>> 
>>> Koha mailing list  http://koha-community.org
>>> Koha at lists.katipo.co.nz
>>> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
>>> 
>> _______________________________________________
>> 
>> Koha mailing list  http://koha-community.org
>> Koha at lists.katipo.co.nz
>> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
>> 
> _______________________________________________
> 
> Koha mailing list  http://koha-community.org
> Koha at lists.katipo.co.nz
> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha



More information about the Koha mailing list