Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

how to purge old packages

Avatar

Level 2

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

Is there any way to remove old pacakges..

1 Accepted Solution

Avatar

Correct answer by
Level 2

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. 

View solution in original post

5 Replies

Avatar

Level 2

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

using install arguments .. 

Avatar

Correct answer by
Level 2

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. 

Avatar

Level 2

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?

Avatar

Level 2

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