[ale] bash script
Geoffrey
lists at serioustechnology.com
Tue Sep 11 10:51:33 EDT 2007
Marvin, International Martian of Mystery wrote:
> I'd like some feedback/critique for a script I'm running as a cron job
> daily on a box I administrate. It's supposed to delete all the files it
> finds that are 5 days or older.
>
> This is what I've come up with:
Is there any reason you don't simply do this:
BASE=/var/www/zm/events
/usr/bin/find $BASE/[123569] $BASE/1[0-5] ! -name "*.log" -mtime 5
-print | /sbin/rm -Rf $1"
???
>
>
>
> #! /bin/sh
>
> ## Remove ZoneMinder events cache
> ## There's gotta be a better way to
> ## do this!
>
> EXECUTE="/usr/bin/find ./ ! -name "*.log" -mtime 5 -print | /sbin/rm
> -Rf $1"
>
>
> cd /var/www/zm/events/1
> $EXECUTE
> cd /var/www/zm/events/2
> $EXECUTE
> cd /var/www/zm/events/3
> $EXECUTE
> cd /var/www/zm/events/5
> $EXECUTE
> cd /var/www/zm/events/6
> $EXECUTE
> cd /var/www/zm/events/9
> $EXECUTE
> cd /var/www/zm/events/10
> $EXECUTE
> cd /var/www/zm/events/11
> $EXECUTE
> cd /var/www/zm/events/12
> $EXECUTE
> cd /var/www/zm/events/13
> $EXECUTE
> cd /var/www/zm/events/14
> $EXECUTE
> cd /var/www/zm/events/15
> $EXECUTE
>
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
>
--
Until later, Geoffrey
Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety.
- Benjamin Franklin
More information about the Ale
mailing list