Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
kumaranfAccepted solution
Level 2
Oct 16, 2015 2:28 AM UTC

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

Level 2
Oct 16, 2015 2:28 AM UTC

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

Translate
smacdonald2008
Level 10
Oct 16, 2015 2:28 AM UTC

Here is a very good community article on this subject:

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

Translate
Level 2
Oct 16, 2015 2:28 AM UTC

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?

Translate
kumaranfAccepted solution
Level 2
Oct 16, 2015 2:28 AM UTC

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. 

Translate
Venugopal_Gumma
Level 3
Oct 16, 2015 2:28 AM UTC

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

using install arguments .. 

Translate