Cron to delete files older than X days

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am facing a problem while running a cron to delete files older that X
days in a particular folder. Initially I had configured the cron as below;

*[oracle@TESTDBS daily_backup]$ crontab -l*
*10 3 * * * /home/oracle/backup.sh*
*@daily find /home/oracle/daily_backup/* -mtime +2 -exec rm {} \;*

But this deletes everything from the backup folder and I dont see any files
in it.
But when I run "* find /home/oracle/daily_backup/* -mtime +2 -exec rm {}
\;" *manually "nothing happens". I mean it doesn't delete anything.

What could be the issue here?? Even I tried below but no success;

*[oracle@TESTDBS daily_backup]$ ls -altr*
*-rw-r-----  1 oracle dba  123801600 Apr 12 12:16 120412_full_dbexp.dmp*
*-rw-r--r--  1 oracle dba     116275 Apr 12 12:16 120412_expdp_full.log*
*drwx------ 12 oracle dba       4096 Apr 12 12:21 ..*
*drwxrwxrwx  2 root   root      4096 Apr 12 12:21 .*
*-rw-r--r--  1 oracle dba         20 Oct 10  2012 test.txt*
*[oracle@TESTDBS daily_backup]$*
*[oracle@TESTDBS daily_backup]$*
*[oracle@TESTDBS daily_backup]$ find /home/oracle/daily_backup/ -mtime +30
-delete*
*[oracle@TESTDBS daily_backup]$ ls*
*120412_expdp_full.log  120412_full_dbexp.dmp  test.txt*
*[oracle@TESTDBS daily_backup]$*
*[oracle@TESTDBS daily_backup]$ ls -altr*
*total 121156*
*-rw-r-----  1 oracle dba  123801600 Apr 12 12:16 120412_full_dbexp.dmp*
*-rw-r--r--  1 oracle dba     116275 Apr 12 12:16 120412_expdp_full.log*
*drwx------ 12 oracle dba       4096 Apr 12 12:21 ..*
*drwxrwxrwx  2 root   root      4096 Apr 12 12:21 .*
*-rw-r--r--  1 oracle dba         20 Oct 10  2012 test.txt*
*[oracle@TESTDBS daily_backup]$*
*[oracle@TESTDBS daily_backup]$ find /home/oracle/daily_backup -type f
-mtime +2 -exec rm {} \;*
*[oracle@TESTDBS daily_backup]$ ls -altr*
*total 121156*
*-rw-r-----  1 oracle dba  123801600 Apr 12 12:16 120412_full_dbexp.dmp*
*-rw-r--r--  1 oracle dba     116275 Apr 12 12:16 120412_expdp_full.log*
*drwx------ 12 oracle dba       4096 Apr 12 12:21 ..*
*drwxrwxrwx  2 root   root      4096 Apr 12 12:21 .*
*-rw-r--r--  1 oracle dba         20 Oct 10  2012 test.txt*
*[oracle@TESTDBS daily_backup]$*
*
*
*
*
*Regards,*
*Raj*
-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list


[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux