Hi, I am trying to delete files that are more than 7 days old. When I run it interactively it works, no problem, but it does not run from a file stored in cron.daily. The rest of that daily file runs properly. [The execute bit is on]. I don't see anything in the /var/log/messages. --------------------------------------- #!/bin/bash find /mnt/iog -type f -name '*.tar.gz' -mtime +7 | xarg rm --------------------------------------- Any idea what am I missing? -- Thanks http://www.911networks.com When the network has to work
On Fri, Feb 22, 2008 at 01:40:11PM -0800, centos at 911networks.com alleged:> Hi, > > I am trying to delete files that are more than 7 days old. When I > run it interactively it works, no problem, but it does not run > from a file stored in cron.daily. The rest of that daily file > runs properly. [The execute bit is on]. > > I don't see anything in the /var/log/messages. > > --------------------------------------- > #!/bin/bash > > find /mnt/iog -type f -name '*.tar.gz' -mtime +7 | xarg rm > --------------------------------------- > > Any idea what am I missing?'xargs' instead of 'xarg'? Is there an error message? "it does not run" is rather vague. -- Garrick Staples, GNU/Linux HPCC SysAdmin University of Southern California Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: <http://lists.centos.org/pipermail/centos/attachments/20080222/e378ea90/attachment.sig>
centos at 911networks.com wrote:> Hi, > > I am trying to delete files that are more than 7 days old. When I > run it interactively it works, no problem, but it does not run > from a file stored in cron.daily. The rest of that daily file > runs properly. [The execute bit is on]. > > I don't see anything in the /var/log/messages. > > --------------------------------------- > #!/bin/bash > > find /mnt/iog -type f -name '*.tar.gz' -mtime +7 | xarg rm > --------------------------------------- > > Any idea what am I missing? >Just a shot in the dark: Cron is kinda partial to absolute paths. Change your 1-liner to: /usr/bin/find /mnt/iog -type f -name '*.tar.gz' -mtime +7 | xargs rm That, and the "xargs" that Garrick pointed out. Good luck.