Skip to main content

Auto delete backup cron job

Comments

3 comments

  • cPanelLauren
    Have you tried using -delete instead? If you run that command manually do you not get an error? find /home/$user/backupdir/ -name "*.sql" -type f -mtime +4 -delete
    I tested this on my personal server and can confirm it works.
    0
  • optimusproweb
    Have you tried using -delete instead? If you run that command manually do you not get an error? find /home/$user/backupdir/ -name "*.sql" -type f -mtime +4 -delete
    I tested this on my personal server and can confirm it works.

    I'll try with this code and I'll let you know. Thank you!
    0
  • virtualworldGlobal
    Hi We have a script, but need some modifications ---------------------------- 0 4 * * * find /home/user_name/public_html -maxdepth 1 -type f -mtime +7 -name 'backup-*.tar.gz' -delete ---------------------------- We want this to be used - 1. It should look only for backups as - .tar.gz only within the home directory 2. It should run daily and will delete all tar.gz backups 0 days old automatically using Cron Thanks
    0

Please sign in to leave a comment.