vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Linux command for deleting files after x number of days (https://vborg.vbsupport.ru/showthread.php?t=204268)

USAMustangs.com 02-04-2009 11:49 PM

Linux command for deleting files after x number of days
 
Hello.

I'm using a .php script that automatically performs a full cPanel backup via cron job. Space will become an issue real quick with these daily backups dumping into my root. I'm not using the ftp option to move them elsewhere at this time.

I would like to set up a cron job in cPanel to automatically delete all cPanel backups that are 3 days old or older.

Is this the correct command to do so or am I completely off base? If so, what is the correct command to work on cPanel 11 over Linux?

find /home/user/backup-* -mtime +3 -exec rm {}\;

The typical full backup reads like this /home/user/backup-2.4.2009_18-11-01_user.tar.gz I'm assuming the backup-* wildcard is correct usage as well.

Thanks.

Dismounted 02-05-2009 03:49 AM

This is a line from my DB backup cron:
Code:

find /home/default/backups -name 'db*' -type f -ctime +6 -delete;

USAMustangs.com 02-05-2009 01:32 PM

I have a question about the second argument in the command line. -name 'db*'

I want this cron job to delete only e.g. /home/user/backup-2.4.2009_18-11-01_user.tar.gz files

How does the argument -name 'db*' removed those tar.gz files? I'm asking because I'm a novice with Linux command not because I'm challenging your method.

Thanks.

Dismounted 02-06-2009 08:30 AM

That line is from my own cronjob. My DB backups are in the form db-2009-01-31, and my data ones data-2009-01-31. You probably want something like:
Code:

find /home/user -name 'backup*' -type f -ctime +6 -delete;

USAMustangs.com 02-06-2009 01:45 PM

Looks like that's going to work. Thanks for your help.


All times are GMT. The time now is 07:11 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01199 seconds
  • Memory Usage 1,711KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete