Expand my Community achievements bar.

healthcheck.html AEM6.1

Avatar

Level 2

I use a file named heathcheck.html, contained in the root folder of my website on my distributor, for my F5 to detect if a server is up or not. AEM recommends that I put it on the publisher, yes, the publisher and distributor are pinned together. If I put it on the publisher it is now located in the JCR and in order to remove a particular server from production I have to go into the CRX and rename the file. Is there any way to script this to be able to do it from an ssh session? 

9 Replies

Avatar

Level 3

You can do pretty much anything with curl commands. I'm not aware of one for renaming a file, but you could copy it to a new place and then delete the node. Check out https://gist.github.com/sergeimuller/2916697 

Avatar

Level 2

Interesting. this looks close to what I might be able to use.

Copy page
        curl -u admin:admin -F cmd=copyPage -F destParentPath=/path/to/destination/parent -F srcPath=/path/to/source/locaiton http://localhost:4502/bin/wcmcommand
 

I wonder if there is a move page command also?

Avatar

Level 7

Yes you can use movePage command also-

  curl -u admin:admin -F cmd=movePage -F destParentPath=/path/to/destination/parent -F srcPath=/path/to/source/locaiton http://localhost:4502/bin/wcmcommand

It will delete the page from source and paste it to destination node.

Response will look like this:-

C:\Users\ankur.ahlawat>curl -u admin:admin -F cmd=movePage -F destParentPath=/content/aemtutorials -F srcPath=/content/aemtutorials/en/home/fr http://localhost:4502/bin/wcmcommand
<html>
<head>
    <title>OK</title>
</head>
    <body>
    <h1>OK</h1>
    <table>
        <tbody>
            <tr>
                <td>Status</td>
                <td><div id="Status">200</div></td>
            </tr>
            <tr>
                <td>Message</td>
                <td><div id="Message">/content/aemtutorials/fr
</div></td>
            </tr>
            <tr>
                <td>Location</td>
                <td><img src="/libs/cq/linkchecker/resources/linkcheck_o.gif" alt="invalid link: /content/aemtutorials/en/home/fr" title="invalid link: /content/aemtutorials/en/home/fr" border="0">/content/aemtutorials/en/home/fr<img src="/libs/cq/linkchecker/resources/linkcheck_c.gif" border="0"></td>
            </tr>
            <tr>
                <td>Parent Location</td>
                <td><a href="https://forums.adobe.com/content/aemtutorials/en/home" id="ParentLocation">/content/aemtutorials/en/home</a></td>
            </tr>
            <tr>
                <td>Path</td>
                <td><div id="Path">/content/aemtutorials/en/home/fr</div></td>
            </tr>
            <tr>
                <td>Referer</td>
                <td><a href="" id="Referer"></a></td>
            </tr>
            <tr>
                <td>ChangeLog</td>
                <td><div id="ChangeLog">&lt;pre&gt;&lt;/pre&gt;</div></td>
            </tr>
        </tbody>
    </table>
    <p><a href="">Go Back</a></p>
    <p><img src="/libs/cq/linkchecker/resources/linkcheck_o.gif" alt="invalid link: /content/aemtutorials/en/home/fr" title="invalid link: /content/aemtutorials/en/home/fr" border="0">Modified Resource<img src="/libs/cq/linkchecker/resources/linkcheck_c.gif" border="0"></p>
    <p><a href="https://forums.adobe.com/content/aemtutorials/en/home">Parent of Modified Resource</a></p>
    </body>
</html>

Avatar

Level 2

This looks like it will work for me.

The other option would be to remotely install/uninstall a package that had the file name different in each package?

Avatar

Level 3

That should also work, so long as the package includes the one folder as empty and the other with the file, and the file is the same across instances

Avatar

Level 2

That is a good point. Also it will remove all the files on all the publishers, which will take the whole site down. I only want to remove one publisher at a time.

Avatar

Level 2

Well I ran across a problem with movePage.

<td><div id="Message">Error during copy/move operation (Error while moving page /etc/designs/site/health/healthcheck.html to /etc/designs/site/health/healthcheck_no.html/healthcheck.html)</div></td>

I can do this in CRX.

Is there a renamepage? Or maybe I will have to move the page to another folder and then move it back.

Avatar

Level 2

It appears that I can target just the publishers to install packages.

I manually renamed the Healthcheck.html to Healthcheck_no.html and created a package called Rename_HealthCheck.html_To_Healthcheck_no.html.zip

I am now installing it to and from the publisher using curl. Anyone seeing anything wrong with this?

curl -u admin:admin -X POST http://localhost:4503/crx/packmgr/service/.json/etc/packages/my_packages/Rename_Healthcheck.html_to_...

curl -u admin:admin -X POST http://localhost:4503/crx/packmgr/service/.json/etc/packages/my_packages/Rename_Healthcheck.html_to_...