From: rvaede on 1 Jul 2010 09:37 I put this command in crontab I wanted to delete all the files in the subdirectories its not doing that: /bin/find /archive/backup/fixed -mtime +10 -exec rm -rf {} \; > /dev/ null 2>&1 Fixed has a bunch of sub-directories and within the sub-directories there are lots of files that wanted to delete if they exceed 10 days.
From: Ben Bacarisse on 1 Jul 2010 09:54 rvaede <rvaedex23(a)gmail.com> writes: > I put this command in crontab I wanted to delete all the files in the > subdirectories its not doing that: > > /bin/find /archive/backup/fixed -mtime +10 -exec rm -rf {} \; > /dev/ > null 2>&1 (1) is find in /bin (it is not on my system)? (2) what does the real crontab entry look like? I.e. post the real entry not just the command part and try to avoid introducing newlines -- they matter to cron. (3) Does your cron see the \ as an escape so find does not see it? Try ';' instead of \;. (4) Don't redirect output while debugging. It helps to see any error output. -- Ben.
From: rvaede on 1 Jul 2010 10:12 On Jul 1, 9:54 am, Ben Bacarisse <ben.use...(a)bsb.me.uk> wrote: > rvaede <rvaede...(a)gmail.com> writes: > > I put this command in crontab I wanted to delete all the files in the > > subdirectories its not doing that: > > > /bin/find /archive/backup/fixed -mtime +10 -exec rm -rf {} \; > /dev/ > > null 2>&1 > > (1) is find in /bin (it is not on my system)? > (2) what does the real crontab entry look like? I.e. post the real entry > not just the command part and try to avoid introducing newlines -- they > matter to cron. > (3) Does your cron see the \ as an escape so find does not see it? Try > ';' instead of \;. > (4) Don't redirect output while debugging. It helps to see any error > output. > > -- > Ben. Thank you for pointing this out it should of been /usr/bin/find.
From: John Kelly on 1 Jul 2010 10:12 On Thu, 1 Jul 2010 06:37:09 -0700 (PDT), rvaede <rvaedex23(a)gmail.com> wrote: > >I put this command in crontab I wanted to delete all the files in the >subdirectories its not doing that: > >/bin/find /archive/backup/fixed -mtime +10 -exec rm -rf {} \; > /dev/ >null 2>&1 > >Fixed has a bunch of sub-directories and within the sub-directories >there are lots of files that wanted to delete >if they exceed 10 days. do:~ # which find /usr/bin/find So verify where your find command is. Also, use: find /archive/backup/fixed -mindepth 1 so you won't include the "fixed" directory itself. But otherwise I don't see a problem. Try running it by hand with -exec echo {} instead of "rm -rf" to see what it finds. -- Web mail, POP3, and SMTP http://www.beewyz.com/freeaccounts.php
From: John Kelly on 1 Jul 2010 10:21 On Thu, 01 Jul 2010 14:54:50 +0100, Ben Bacarisse <ben.usenet(a)bsb.me.uk> wrote: >rvaede <rvaedex23(a)gmail.com> writes: > >> I put this command in crontab I wanted to delete all the files in the >> subdirectories its not doing that: >> >> /bin/find /archive/backup/fixed -mtime +10 -exec rm -rf {} \; > /dev/ >> null 2>&1 >(3) Does your cron see the \ as an escape so find does not see it? Try >';' instead of \;. Yes cron can be picky. I tend to put my commands in a shell script and run the script from cron. > test -x /usr/local/sbin/myscript && { /usr/local/sbin/myscript || echo "myscript rc=$?"; } -- Web mail, POP3, and SMTP http://www.beewyz.com/freeaccounts.php
|
Next
|
Last
Pages: 1 2 Prev: escaping directory name space Next: printf and conversion of negative numbers (Hex2Dec) |