In camel route I am making curl with grep using exec component but grep with ${HOSTNAME} not working,below is my camel route.Please need help on this.
@Component
public class VideoFilesOperationRoute extends RouteBuilder {
@Value("${scheduler.cronExpression}")
private String cron;
@Override
public void configure() throws Exception {
from("quartz2://videoFilesOperations/everydayMidnight?cron=" + cron)
.to("exec:curl?args= --silent http://localhost:4040/ | grep ${HOSTNAME}&useStderrOnEmptyStdout=true")
.to("bean:videoFilesOperationImpl?method=videoFilesOperation");
}
}
Tried Below solution but still the same issue:
//Tried this first
List<String> args = new ArrayList<>();
args.add("-c");
args.add("curl --silent http://localhost:4040/ | grep ${HOSTNAME}");
from("quartz2://videoFilesOperations/everydayMidnight?cron=" + cron)
.setHeader(ExecBinding.EXEC_COMMAND_ARGS, constant(args))
.to("exec:/bin/sh")
.to("bean:videoFilesOperationImpl?method=videoFilesOperation");
//Tried this next
from("quartz2://videoFilesOperations/everydayMidnight?cron=" + cron)
.to("exec:scripts/curl.sh")
.to("bean:videoFilesOperationImpl?method=videoFilesOperation");