Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

AEM 6.3, CommandLineProcess: failed to execute command

Avatar

Level 2

I am trying to create renditions for a gif file using Gifsicle: Command-Line Animated GIFs  When I run the command in my terminal its works but when ran from inside the workflow (still on my local machine) it fails:

Command (in workflow):

/usr/local/Cellar/gifsicle/1.90/bin/gifsicle ${filename} --resize 1680x1680 > cq5dam.web.1680.1680.gif

error.log:

*ERROR* [JobHandler: /etc/workflow/instances/server1/2017-11-29/update_asset_3:/content/dam/1000rendition/testgif.gif/jcr:content/renditions/original]

com.day.cq.dam.core.process.CommandLineProcess execute: failed to execute command

[[/usr/local/Cellar/gifsicle/1.90/bin/gifsicle, testgif.gif, --resize, 1680x1680, >, cq5dam.web.1680.1680.gif]]  for asset [/content/dam/1000rendition/testgif.gif]:

org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)

at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)

at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)

at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:153)

at com.day.cq.dam.core.process.CommandLineProcess$2.run(CommandLineProcess.java:276)

at com.day.cq.dam.core.impl.jmx.AssetUpdateMonitorImpl$UpdateStep.checkAndRun(AssetUpdateMonitorImpl.java:978)

at com.day.cq.dam.core.process.CommandLineProcess.execute(CommandLineProcess.java:194)

at com.day.cq.workflow.compatibility.CQWorkflowProcessRunner.execute(CQWorkflowProcessRunner.java:93)

at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:189)

at com.adobe.granite.workflow.core.job.JobHandler.process(JobHandler.java:258)

at org.apache.sling.event.impl.jobs.JobConsumerManager$JobConsumerWrapper.process(JobConsumerManager.java:500)

at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.startJob(JobQueueImpl.java:291)

at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.access$100(JobQueueImpl.java:58)

at org.apache.sling.event.impl.jobs.queues.JobQueueImpl$1.run(JobQueueImpl.java:227)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at java.lang.Thread.run(Thread.java:745)

I have no idea why this is failing, the logging is not really helping. All help is appreciated, thanks in advance!

2 Replies

Avatar

Level 5

Apparently  ` > cq5dam.web.1680.1680.gif` is not allowed as part of the command as discussed here: https://stackoverflow.com/questions/43120035/processbuilder-failing-when-calling-a-system-command-wh.... You can fix it by setting a redirectOutput on the builder but of course this is deeply nested into the workflow and is not easily changed.

Avatar

Level 5

I am now able to create renditions using gifsicle using following commands in my step:

cp ${filename} cq5dam.web.1680.1680.gif

gifsicle --batch cq5dam.web.1680.1680.gif --resize 1680x1680

cp ${filename} cq5dam.web.1024.1024.gif

gifsicle --batch cq5dam.web.1024.1024.gif --resize 1024x1024

cp ${filename} cq5dam.web.600.600.gif

gifsicle --batch cq5dam.web.600.600.gif --resize 600x600