MySQL Plugin Feature Request

  • Hello everyone,
    I'm running a personal Wordpress site on my NAS using MySQL plugin to store the database. The plugin is good since it allows you to auto-backup the database into a defined shared folder whenever you want creating a cron-job.
    My question is if it would be very difficult to implement a feature which would let the user to delete old SQL dumps from the shared folder. Like in the RSnapshot plugin where you can select how many daily, weekly, monthly... backups do you want to keep.


    If it can not be implemented in the plugin, is there any way to do a cron-job or something to delete SQL dumps older than X days?



    Thank you!
    Guillem

    DISCLAIMER: :!: I'm not a native English speaker, I'm sorry if I don't explain as good as you would want. :!:


    My NAS:
    Always the latest OMV Erasmus running on an AMD Sempron 3850 @1.3GHz with 4.9.0 Backports Kernel
    with 120GB Samsung SSD 850 EVO for OpenMediaVault & 2x500GB Primary Data HDD + 1TB Secondary HDD for Backup & 2TB USB 3.0 External HDD for offline backup


    Plugin list:
    Flash Memory, Locate, OMV-Extras.org, RSnapshot, Sensors, Syncthing, SMB/CIFS, SSH, USB Backup
    _____________________________________________________________________________________________________________________________


    Quote

    The Schrödinger's code is that one which is going to work and it's full of bugs at the same time; until you test it, you won't be able to determine it.

  • I use a script to dump, compress and delete old sql dumps.

    You can try that line whit Scheduled jobs, that example will delete sql dumps older then 30 days but keeps a minimum of 5 dumps.


    find /backup_path -type f -mtime +30 -name '*.sql' | head -n -5 | xargs rm {} \;


    but use it whit care, wrong path or filename wildcard and rm flush the wrong files

  • Thanks for that script @LooR. Since I'm a bit novice in Linux and scripting commands, I'll save the script but I'll not use it until I'm a bit more experienced; just in case I broke something and I delete all the root directory ;(


    Thanks again to share it with us.


    Guillem

    DISCLAIMER: :!: I'm not a native English speaker, I'm sorry if I don't explain as good as you would want. :!:


    My NAS:
    Always the latest OMV Erasmus running on an AMD Sempron 3850 @1.3GHz with 4.9.0 Backports Kernel
    with 120GB Samsung SSD 850 EVO for OpenMediaVault & 2x500GB Primary Data HDD + 1TB Secondary HDD for Backup & 2TB USB 3.0 External HDD for offline backup


    Plugin list:
    Flash Memory, Locate, OMV-Extras.org, RSnapshot, Sensors, Syncthing, SMB/CIFS, SSH, USB Backup
    _____________________________________________________________________________________________________________________________


    Quote

    The Schrödinger's code is that one which is going to work and it's full of bugs at the same time; until you test it, you won't be able to determine it.

  • Finally I tested this with a testing database but I got these errors:



    Code
    root@OMV:~# find /media/8ed09fff-96f5-4b07-ac70-4aa015cb2a0c/Guillem/WordpressBackup/DB -type f -mtime +30 -name '*.sql' | head -n -5 | xargs rm {} \;
    rm: no s’ha pogut eliminar «{}»: El fitxer o directori no existeix
    rm: no s’ha pogut eliminar «;»: El fitxer o directori no existeix



    It says that it could not delete {}: File or directory not found.
    Same for ;


    Did I miss something or you made a typo?



    Thanks.

    DISCLAIMER: :!: I'm not a native English speaker, I'm sorry if I don't explain as good as you would want. :!:


    My NAS:
    Always the latest OMV Erasmus running on an AMD Sempron 3850 @1.3GHz with 4.9.0 Backports Kernel
    with 120GB Samsung SSD 850 EVO for OpenMediaVault & 2x500GB Primary Data HDD + 1TB Secondary HDD for Backup & 2TB USB 3.0 External HDD for offline backup


    Plugin list:
    Flash Memory, Locate, OMV-Extras.org, RSnapshot, Sensors, Syncthing, SMB/CIFS, SSH, USB Backup
    _____________________________________________________________________________________________________________________________


    Quote

    The Schrödinger's code is that one which is going to work and it's full of bugs at the same time; until you test it, you won't be able to determine it.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!