Expand my Community achievements bar.

CURL Command

Avatar

Former Community Member

How to configure Replication agent on author to publish items on publisher by using curl command?

 

As per the previous forum question i followed the script but didnt working

#!/bin/bash
if [ $# -ne 2 ] ; then
        echo "Syntax Error!"
         echo "$0 <publisher_hostname_to_replicate_to> <author hostname>"
        exit 1

fi
AUTHOR_NAME="ec2-54-152-33-162.compute-1.amazonaws.com" # This is the hostname of the author.
PUBLISHER_NAME="ec2-52-7-167-198.compute-1.amazonaws.com" #This is the hostname of the publisher that the author will replicate to.
REPL_USER="admin" # This should be set to the publisher's replication user accountname.
REPL_PASSWORD="admin" # This should be set to the publisher's password for the replication user.
AUTHOR_PORT="4502"
PUBLISHER_PORT="4503"
AUTHOR="http://${AUTHOR_NAME}:${AUTHOR_PORT}"
PUBLISHER="http://${PUBLISHER_NAME}:${PUBLISHER_PORT}"
URI="${PUBLISHER}/bin/receive?sling:authRequestLogin=1"

#First, create the page.
curl -u admin:admin --data "status=browser&cmd=createPage&label=${PUBLISHER_NAME}&title=${PUBLISHER_NAME}&parentPath=/etc/replication/agents.author&template=/libs/cq/replication/templates/agent" ${AUTHOR}/bin/wcmcommand


# set the jcr properties.
curl -u admin:admin -F "jcr:primaryType=cq:Page" \
 -F "jcr:primaryType=nt:unstructured" \
-F "jcr:content/jcr:title=${PUBLISHER_NAME}" \
-F "jcr:content/sling:resourceType=cq/replication/components/agent" \
-F "jcr:content/loglevel=info" \
-F "jcr:content/retryDelay=60000" \
-F "jcr:content/serializationType=Default" \
-F "jcr:content/transportUser=admin" \
-F "jcr:content/transportUri=${URI}" \
 -F "jcr:content/transportPassword=admin" \
-F "jcr:content/jcr:description=${PUBLISHER_NAME} replication" \
-F "jcr:content/enabled=true" \
${AUTHOR}/etc/replication/agents.author/${PUBLISHER_NAME}

1 Reply

Avatar

Employee

Hi Ankit,

 

What do you mean by it didn't work: Was there an error executing the script or an error from AEM?  What error did you get? What version of AEM are you using?

 

Regards,

Opkar