X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=scripts%2Fdump-db-svn.sh;h=0c3c3688121fc256c1b9e571d2b08632d150a10a;hb=a8aa1baef6f4d1df60f44d1d542912acff913226;hp=362fddcb337dd3574d75a686108940b45d153456;hpb=9007c947a26fb9cba5e50ec149e3a5ba0bcaf636;p=infrastructure.git diff --git a/scripts/dump-db-svn.sh b/scripts/dump-db-svn.sh index 362fddc..0c3c368 100755 --- a/scripts/dump-db-svn.sh +++ b/scripts/dump-db-svn.sh @@ -13,9 +13,33 @@ LOGDIR=$DATADIR/aa-dumplog LOG=$LOGDIR/${DATE}.log LATESTLOG=latest.log -REVISION="$Revision$" - -source $COMMANDDIR/functions.sh +### create a symlink in same dir +# arguments +# actual : full path of the actual file +# link : the link name, only basename is used, will be created in same dir +function manage_link () { + actual=$1; shift + latest=$1; shift + # go in the right directory + cd $(dirname $actual) + actualbase=$(basename $actual) + # just in case + latest=$(basename $latest) + echo "In $(pwd) : linking $actualbase to $latest" + rm -f $latest ; ln -s $actualbase $latest + # go back to current dir + cd - +} + +# usage +# clean [... find arguments] +function clean () { + where=$1; shift + keeptime=$1; shift + echo "== In $where" + echo "Cleaning $@ - older than $keeptime days" + find $where "$@" -atime +$keeptime | xargs rm +} ### @@ -37,7 +61,7 @@ SUBVERSION_KEEPTIME=7 SUBVERSION_REPO=/svn function usage () { - echo "This is $COMMAND, $REVISION" + echo "This is $COMMAND" echo "Usage: $COMMAND [subversion]" echo -e "\tkeyword 'subversion' : $SUBVERSION_REPO/ is dumped" # echo -e "\tkeyword 'apache' : $APACHE_ROOT/ is tared"