Chris Hecker <chec...@d6.com> writes:

> Okay, is there any reason this is a bad idea?

> [root] /var/cosign# cat /etc/cron.hourly/cosign
> #!/bin/bash
> dirs=( /var/cosign/filter /var/cosign/daemon /var/cosign/tickets )
> for d in ${dirs[@]}; do
>          [ -d $d ] && /usr/bin/find $d -type f -mtime +0 | 
> /usr/bin/xargs /bin/rm -f
> done
> exit 0

It's more a matter of cleanliness than necessity in this particular case,
but if you can assume GNU find, add a -print0 to the end of the find
command and a -0 flag to xargs so that this is robust against file names
containing whitespace.  It's generally best practice for any find | xargs
code to use nul-termination when you can, just in case.

(Consider, for example, the file name "/var/cosign/filter/f /etc/shadow",
not that anything that would create such a file probably has access to do
so in that directory.)

-- 
Russ Allbery (r...@stanford.edu)             <http://www.eyrie.org/~eagle/>

------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
Cosign-discuss mailing list
Cosign-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cosign-discuss

Reply via email to