how to purge old packages | Community
Skip to main content
Level 2
October 16, 2015
Solved

how to purge old packages

  • October 16, 2015
  • 5 replies
  • 5484 views

How to purge old packages from crx/packmgr/index.jsp....

Is there any way to remove old pacakges..

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by kumaranf

1. Create a small workflow to find nodes under "/etc/packages" where jcr:created has value older than 90 days (say).

    This will return you nodes of paths like:

    /etc/packages/Group_Name and /etc/packages/Group_Name/.snapshot

2. Delete these nodes. 

3. Your TarPM and datastorage cleanup will take care of retrieving the used space. 

5 replies

Venugopal_Gumma
Level 3
October 16, 2015

you cannot purge packages as such .. same name packages can be versioned or over-written when installed by 

using install arguments .. 

kumaranfAccepted solution
Level 2
October 16, 2015

1. Create a small workflow to find nodes under "/etc/packages" where jcr:created has value older than 90 days (say).

    This will return you nodes of paths like:

    /etc/packages/Group_Name and /etc/packages/Group_Name/.snapshot

2. Delete these nodes. 

3. Your TarPM and datastorage cleanup will take care of retrieving the used space. 

Level 2
October 16, 2015

i thought we can purge the old packages using the script provided by Yogesh.

we have hundreds of packages that we need to purge.

So are you saying that there is no way to purge these files?

smacdonald2008
Level 10
October 16, 2015

Here is a very good community article on this subject:

http://www.wemblog.com/2012/01/how-to-delete-packages-created-before.html

Level 2
October 16, 2015

Thanks Donald....i already tried it but was not successful....

I am using below script mentioned in the article…

Please let me know.

#!/bin/ksh

ADMIN="hostname:port number"

ADMIN_CRED="admin:admin"

PACKAGE_LOCATION="/etc/packages/my_packages"

ALL_PATHS=`curl -s -u $ADMIN_CRED "$ADMIN/bin/querybuilder.json?path=$PACKAGE_LOCATION&type=nt:file&p.limit=-1&daterange.property=jcr:created&daterange.upper

Bound=2013-12-31&daterange.upperOperation=`

#echo "$ALL_PATHS"

for SINGLE_PATH in $ALL_PATHS

do

echo "$SINGLE_PATH"

#curl -u $ADMIN_CRED -X POST http://$ADMIN/crx/packmgr/service/.json$SINGLE_PATH?cmd=delete

Done

 

When I run echo "$SINGLE_PATH" –I get below output

+ echo 39638.zip","lastModified":"2012-11-01

39638.zip","lastModified":"2012-11-01

+ echo 08:27:42","created":"2012-11-01

08:27:42","created":"2012-11-01

+ echo 08:26:45","size":"11

08:26:45","size":"11

+ echo KB","mimeType":"application/zip"},{"path":"/etc/packages/my_packages/10-28

KB","mimeType":"application/zip"},{"path":"/etc/packages/my_packages/10-28

+ echo update.zip","excerpt":"application/zip","name":"10-28

update.zip","excerpt":"application/zip","name":"10-28

 

when I run curl -u $ADMIN_CRED -X POST http://$ADMIN/crx/packmgr/service/.json$SINGLE_PATH?cmd=delete

I get below error messages..

</body></html>+ curl -u admin:qa6admin123 -X POST http://hostname:port/crx/packmgr/service/.jsonKB","mimeType":"application/zip"},{"path":"/etc/packages/my_packages/11-13?cmd=delete

curl: (3) [globbing] unmatched close brace/bracket at pos 98

+ curl -u admin:admin  -X POST http://hostname:port/crx/packmgr/service/.jsonUpdate?cmd=delete

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">

<html><head>

    <style type="text/css">

        body {

            background-color: white;

            font-family: verdana, arial, sans-serif;

            font-size: 12px;

            white-space: nowrap;

        }

        div {

            font-family: courier, monospace;

            font-size: 11px;

        }

    </style>

    <script type="text/javascript">

        function onStatus(pid, stat, p, max, msg) {

            window.parent.cqPackageShareClient.onStatus(pid, stat, p, max, msg);

            window.scrollTo(0, 1000000);

        }

    </script></head>

<body><br><span class="error">Error during processing.</span><br><code><pre>

java.lang.IllegalArgumentException: no package

        at com.day.crx.packaging.impl.J2EEPackageManager.getPackage(J2EEPackageManager.java:234)

 

 

</body></html>+ curl -u admin:qa6admin123 -X POST http://hostname:port/crx/packmgr/service/.jsonKB","mimeType":"application/zip"},{"path":"/etc/packages/my_packages/slider.zip","excerpt":"application/zip","name":"slider.zip","title":"slider.zip","lastModified":"2012-11-15?cmd=delete

curl: (3) [globbing] unmatched close brace/bracket at pos 98

+ curl -u admin:admin -X POST http://hostname:port/crx/packmgr/service/.json22:36:36","created":"2012-11-15?cmd=delete

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">

<html><head>

    <style type="text/css">

        body {

            background-color: white;

            font-family: verdana, arial, sans-serif;

            font-size: 12px;

            white-space: nowrap;

        }

        div {

            font-family: courier, monospace;

            font-size: 11px;

        }

    </style>

    <script type="text/javascript">

        function onStatus(pid, stat, p, max, msg) {

            window.parent.cqPackageShareClient.onStatus(pid, stat, p, max, msg);

            window.scrollTo(0, 1000000);

        }

    </script></head>

<body><br><span class="error">Error during processing.</span><br><code><pre>

java.lang.IllegalArgumentException: no package

 

 

If I just do echo$SINGLE_PATH >> I see below output.

ALL_PATHS=`curl -s -u $ADMIN_CRED "$ADMIN/bin/querybuilder.json?path=$PACKAGE_LOCATION&type=nt:file&p.limit=-1&daterange.property=jcr:created&daterange.upper

Bound=2013-12-31&daterange.upperOperation=`

#echo "$ALL_PATHS"

for SINGLE_PATH in $ALL_PATHS

do

echo "$SINGLE_PATH"

+ echo 39638.zip","lastModified":"2012-11-01

39638.zip","lastModified":"2012-11-01

+ echo 08:27:42","created":"2012-11-01

08:27:42","created":"2012-11-01

+ echo 08:26:45","size":"11

08:26:45","size":"11

+ echo KB","mimeType":"application/zip"},{"path":"/etc/packages/my_packages/10-28

KB","mimeType":"application/zip"},{"path":"/etc/packages/my_packages/10-28

+ echo update.zip","excerpt":"application/zip","name":"10-28

update.zip","excerpt":"application/zip","name":"10-28

+ echo update.zip","title":"10-28