File:  [ELWIX - Embedded LightWeight unIX -] / elwix / config / etc / uboot / rc.cleaner
Revision 1.2: download - view: text, annotated - select for diffs - revision graph
Mon Sep 15 19:06:47 2014 UTC (9 years, 10 months ago) by misho
Branches: MAIN
CVS tags: elwix2_8, elwix2_7, elwix2_6, elwix2_3, HEAD, ELWIX2_7, ELWIX2_6, ELWIX2_5, ELWIX2_2p0
elwix 2.2

    1: #!/bin/sh
    2: #
    3: # (C)`08 AITNET ltd - Sofia/Bulgaria - office@aitbg.com
    4: #   by Michael Pounov <misho@elwix.org>
    5: #
    6: # example for cron: 0       0       *       *       *       /etc/rc.cleaner <dir> >/dev/null
    7: #
    8: # rc.cleaner <dir> [+days_after_now]
    9: #
   10: # $Id: rc.cleaner,v 1.2 2014/09/15 19:06:47 misho Exp $
   11: #
   12: 
   13: # +10 files oldes 10 days, -10 files newest 10 days, 10 only created before 10 days
   14: PERIOD="+10"
   15: 
   16: if [ -z $1 ]; then
   17: 	echo "Not specified directory for clean ..."
   18: 	exit
   19: else
   20: 	DIR=$1
   21: 	PERIOD=${2:-"${PERIOD}"}
   22: fi
   23: 
   24: /usr/bin/find $DIR -type f -ctime $PERIOD -exec rm -f {} \; >/dev/null 2>&1
   25: /usr/bin/find $DIR -type d -ctime $PERIOD -exec rm -fr {} \; >/dev/null 2>&1
   26: 
   27: exit 0

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