File:  [ELWIX - Embedded LightWeight unIX -] / elwix / config / etc / default / rc.cleaner
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Jul 5 23:43:00 2011 UTC (12 years, 11 months ago) by misho
Branches: misho, MAIN
CVS tags: start, elwix2_8, elwix2_7, elwix2_6, elwix2_3, elwix2_2, elwix2_1, elwix2_0, elwix1_9_mips, elwix1_9, elwix1_8, elwix1_7, elwix1_6, elwix1_5, elwix1_4, Patch1, HEAD, ELWIX2_7, ELWIX2_6, ELWIX2_5, ELWIX2_2p0, ELWIX2_1, ELWIX2_0, ELWIX1_9, ELWIX1_8, ELWIX1_7, ELWIX1_6, ELWIX1_5
ELWIX project

#!/bin/sh
#
# (C)`08 AITNET ltd - Sofia/Bulgaria - office@aitbg.com
#   by Michael Pounov <misho@elwix.org>
#
# example for cron: 0       0       *       *       *       /etc/rc.cleaner <dir> >/dev/null
#
# rc.cleaner <dir> [+days_after_now]
#
# $Id: rc.cleaner,v 1.1.1.1 2011/07/05 23:43:00 misho Exp $
#

# +10 files oldes 10 days, -10 files newest 10 days, 10 only created before 10 days
PERIOD="+10"

if [ -z $1 ]; then
	echo "Not specified directory for clean ..."
	exit
else
	DIR=$1
	PERIOD=${2:-"${PERIOD}"}
fi

/usr/bin/find $DIR -type f -ctime $PERIOD -exec rm -f {} \; >/dev/null 2>&1
/usr/bin/find $DIR -type d -ctime $PERIOD -exec rm -fr {} \; >/dev/null 2>&1

exit 0

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>