[ale] bash script
David Tomaschik
ozone at webgroup.org
Tue Sep 11 10:41:22 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:
>
>
>
>
>
>
>
> #! /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
>
Are 4, 7, and 8 intentionally omitted? If not, why not something like:
for i in `seq 1 15` ; do cd /var/www/zm/events/$i ; $EXECUTE ; done
David
More information about the Ale
mailing list