You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Thomas Jackson <th...@gmail.com> on 2007/10/18 19:02:58 UTC

Cleanup Script

We have an internal repository and are constantly deploying snapshots 
throughout the day.  We want to clean these nightly(to preserve space) 
and I was wondering if anyone had a shell script already written that 
will cleanup snapshots nightly?

Thanks
Thomas Jackson

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Cleanup Script

Posted by Jim Sellers <ji...@gmail.com>.
Another version that does a similar thing:

find /path/to/repo -type d -mtime +15 -name '*SNAPSHOT*' -exec rm -fr {} \;

This will delete any snapshots older than 15 days.

Jim


On 10/18/07, Brett Porter <br...@gmail.com> wrote:
>
> I use Archiva on my own repository to clean up snaphots - it'll remove
> anything older than X days, Y builds, or that has already been
> released (if configured to do so).
>
> I also have a script I've been meaning to look at and put on the wiki
> - will try and do that today.
>
> - Brett
>
> On 19/10/2007, Wayne Fay <wa...@gmail.com> wrote:
> > Not that I've seen, but when you write it later today, maybe you won't
> > mind contributing it back via this list and/or the Wiki for the
> > benefit of future users? ;-)
> >
> > It should be a simple script -- for all directories, if this is a
> > snapshot version, find latest and delete (or move) the rest. Then run
> > it via cron.
> >
> > Wayne
> >
> > On 10/18/07, Thomas Jackson <th...@gmail.com> wrote:
> > > We have an internal repository and are constantly deploying snapshots
> > > throughout the day.  We want to clean these nightly(to preserve space)
> > > and I was wondering if anyone had a shell script already written that
> > > will cleanup snapshots nightly?
> > >
> > > Thanks
> > > Thomas Jackson
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>
> --
> Brett Porter
> Blog: http://www.devzuz.org/blogs/bporter/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Cleanup Script

Posted by Brett Porter <br...@gmail.com>.
I use Archiva on my own repository to clean up snaphots - it'll remove
anything older than X days, Y builds, or that has already been
released (if configured to do so).

I also have a script I've been meaning to look at and put on the wiki
- will try and do that today.

- Brett

On 19/10/2007, Wayne Fay <wa...@gmail.com> wrote:
> Not that I've seen, but when you write it later today, maybe you won't
> mind contributing it back via this list and/or the Wiki for the
> benefit of future users? ;-)
>
> It should be a simple script -- for all directories, if this is a
> snapshot version, find latest and delete (or move) the rest. Then run
> it via cron.
>
> Wayne
>
> On 10/18/07, Thomas Jackson <th...@gmail.com> wrote:
> > We have an internal repository and are constantly deploying snapshots
> > throughout the day.  We want to clean these nightly(to preserve space)
> > and I was wondering if anyone had a shell script already written that
> > will cleanup snapshots nightly?
> >
> > Thanks
> > Thomas Jackson
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Brett Porter
Blog: http://www.devzuz.org/blogs/bporter/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Cleanup Script

Posted by "Alan D. Salewski" <as...@healthmarketscience.com>.
On Thu, Oct 18, 2007 at 02:57:56PM -0400, Alan D. Salewski spake thus:
> Below is a modded version of the quick and dirty 'mvn-clear-snapshots'
> script I have for clearing out SNAPSHOT artifacts for the project I'm
> currently working on. I typically run it prior to performing my first
> build of the day (the version I actually use decends only into the
> directory structure for the project I'm working on).
> 
> This isn't as smart as the hypothetical one that Wayne suggests (mine
> doesn't keep the latest version around). But if you know that someone (or
> something) can be counted on to deploy a snapshot build before too long,
> anyway, maybe it will work "good enough" for you.
> 
> -Al
> 
> ----------------------------------8<-----------------------------------
> #!/bin/sh
> 
> set -x
> 
> M2_REPO_PATH="${HOME}/.m2/repository"
> if ( find "${M2_REPO_PATH}" -type d -name '*SNAPSHOT*' > /dev/null 2>&1 ); then
>     find "${M2_REPO_PATH}" -type d -name '*SNAPSHOT*' -print0 | \
>       xargs --null -I '{}' rm -vfr {}
> fi
> ----------------------------------8<-----------------------------------


Upon reflection, it seems that the version I've been using is more
complicated (and slower) than necessary. Don't know why it was written
that way; probably settled that way after removing other excessive
functionality.

Anyway, here's a simpler version:

----------------------------------8<-----------------------------------
#!/bin/sh

set -x

M2_REPO_PATH="${HOME}/.m2/repository"

find "${M2_REPO_PATH}" -type d -name '*SNAPSHOT*' -print0 | \
  xargs --null -I '{}' rm -vfr '{}'

----------------------------------8<-----------------------------------

-- 
:: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: ::
::
Alan D. Salewski
Software Developer
Health Market Science, Inc.
:: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: ::
:: 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Cleanup Script

Posted by "Alan D. Salewski" <as...@healthmarketscience.com>.
Below is a modded version of the quick and dirty 'mvn-clear-snapshots'
script I have for clearing out SNAPSHOT artifacts for the project I'm
currently working on. I typically run it prior to performing my first
build of the day (the version I actually use decends only into the
directory structure for the project I'm working on).

This isn't as smart as the hypothetical one that Wayne suggests (mine
doesn't keep the latest version around). But if you know that someone (or
something) can be counted on to deploy a snapshot build before too long,
anyway, maybe it will work "good enough" for you.

-Al

----------------------------------8<-----------------------------------
#!/bin/sh

set -x

M2_REPO_PATH="${HOME}/.m2/repository"
if ( find "${M2_REPO_PATH}" -type d -name '*SNAPSHOT*' > /dev/null 2>&1 ); then
    find "${M2_REPO_PATH}" -type d -name '*SNAPSHOT*' -print0 | \
      xargs --null -I '{}' rm -vfr {}
fi
----------------------------------8<-----------------------------------


On Thu, Oct 18, 2007 at 12:48:47PM -0500, Wayne Fay spake thus:
> Not that I've seen, but when you write it later today, maybe you won't
> mind contributing it back via this list and/or the Wiki for the
> benefit of future users? ;-)
> 
> It should be a simple script -- for all directories, if this is a
> snapshot version, find latest and delete (or move) the rest. Then run
> it via cron.
> 
> Wayne
> 
> On 10/18/07, Thomas Jackson <th...@gmail.com> wrote:
> > We have an internal repository and are constantly deploying snapshots
> > throughout the day.  We want to clean these nightly(to preserve space)
> > and I was wondering if anyone had a shell script already written that
> > will cleanup snapshots nightly?
> >
> > Thanks
> > Thomas Jackson
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

-- 
:: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: ::
::
Alan D. Salewski
Software Developer
Health Market Science, Inc.
:: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: ::
:: 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Cleanup Script

Posted by Wayne Fay <wa...@gmail.com>.
Not that I've seen, but when you write it later today, maybe you won't
mind contributing it back via this list and/or the Wiki for the
benefit of future users? ;-)

It should be a simple script -- for all directories, if this is a
snapshot version, find latest and delete (or move) the rest. Then run
it via cron.

Wayne

On 10/18/07, Thomas Jackson <th...@gmail.com> wrote:
> We have an internal repository and are constantly deploying snapshots
> throughout the day.  We want to clean these nightly(to preserve space)
> and I was wondering if anyone had a shell script already written that
> will cleanup snapshots nightly?
>
> Thanks
> Thomas Jackson
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org