Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
April 13–15 - Dare to Unleash a New Professional You at Qlik Connect 2026: Register Now!
cancel
Showing results for 
Search instead for 
Did you mean: 
yzh
Contributor III
Contributor III

Repctl Start Task using REPCTL command line interface return value always 0

We start task through REPCTL command line interface.The task settings is only open Full Load.Regardless of whether the  task reports an error or not, the return value is always 0.We need return other values when task failed.

Labels (1)
1 Solution

Accepted Solutions
OritA
Support
Support

Hi, 

In general, repctl is not  the official APIs for using Replicate commands. In order to perform different actions on Replicate using API you should be using the QEM APIs.  The QEM API manual includes details on how to run the APIs, which parameters to pass and what are the responses. FYI - below is a link to the relevant QEM documentation: 
https://help.qlik.com/en-US/enterprise-manager/May2023/Content/EnterpriseManager/EnterpriseManager_A...

Regards,

 

Orit

 

View solution in original post

3 Replies
OritA
Support
Support

Hi, 

In general, repctl is not  the official APIs for using Replicate commands. In order to perform different actions on Replicate using API you should be using the QEM APIs.  The QEM API manual includes details on how to run the APIs, which parameters to pass and what are the responses. FYI - below is a link to the relevant QEM documentation: 
https://help.qlik.com/en-US/enterprise-manager/May2023/Content/EnterpriseManager/EnterpriseManager_A...

Regards,

 

Orit

 

yzh
Contributor III
Contributor III
Author

Thanks a lot.I installed QEM.I will try the QEM API.

Heinvandenheuvel
Specialist III
Specialist III

The Qlik  Enterprise Manager API is 'the right way to go' to solve this challenge. Excellent!

It needs a server to run on, a configuration, and a license though which _might_ be overkill for some environments.

Indeed the command like REPCTL always return success. My simple explanation for this it is reading a stream of commands without exit on failure for a individual commands. The end of the stream is an implicit or explicit 'exit' and  that yes the final 'exit' command  is successful 🙂

But as it reads that stream of input commands ( Connect; execute this; execute that... ) is produces REPCMD.LOG.

You _could_ solve the status issue by reading that log and finding out what worked (command] Succeeded), what did not. I'm not saying you should, but you could. You need to deal with REPCMD.LOG anyway. It get's produced (after renaming the prior) over and over, and you really want you scripts to clean them up if they do not provide unexpected information.

Or you could follow up the 'start' (execute) command with a 'gettaskstatus' to ask whether the status is expected - RUNNING, STARTING and whether the times like 'full_load_start_time' are after the start time just now.

Here is how I once (before QEM-API) dealt with the REPCTL challenge in Powershell

 

Function CheckRepctlSucceeded ([string[]] $repctl_output, [int] $command_count) 
{
  $log = $logs + '\repcmd.log'
  $bottom_line = ($repctl_output -match 'command] Succeeded').count -1 # Discount for connect/quit
  Write-Verbose "Bottom Line $bottom_line, expected $command_count"
  if ($bottom_line -eq $command_count) {
    if (Test-Path $log) { Remove-Item $log }
  } else {
    write-output "******************** REPCTL OUTPUT ********************" 
    write-output $repctl_output
    write-output "******************** REPCMD.LOG    ********************" 
    Get-Content $log
    write-output "*******************************************************" 
    throw "Only $bottom_line Commands out of $command_count Succeeded"
  }
}

 

 

Hein.