Today, I learned of an option in mgmt_cli that might be useful in scripting contexts: --sync false.
According to the CLI help:
[--sync] {true|false}
Synchronous execution of task - commands that generate the task will wait until the task is finished.
Default {true}
Environment variable: MGMT_CLI_SYNC
In practical terms, this suggests that for calls that would normally return a result right away, you'll get a task-id that can be monitored with show-task.
Where it is the most useful is in install-policy, which, when called with mgmt_cli, acts synchronously (i.e. does not complete until policy is installed).
[Expert@MyMgmt:0]# mgmt_cli -r true install-policy policy-package "Standard"
---------------------------------------------
Time: [11:17:54] 2/2/2026
---------------------------------------------
"Policy installation - Standard" in progress (40%)
...
In investigating this issue further, though, I realized that install-policy returns a task-id by default if called via Web API.
I confirmed it using the below:
[Expert@MyMgmt:0]# curl_cli -k https://127.0.0.1/web_api/install-policy -H 'Content-Type: application/json' -H 'X-chkp-sid: my-session-id' --request POST -d ' { "policy-package" : "Standard" }'
{
"task-id" : "b0c3cf65-b54f-4647-9c03-cf84077b32e1"
}
If I try to use --sync false with, say, run-script, you will get a "stuck" task that never completes until reboot:
[Expert@MyMgmt:0]# mgmt_cli -r true show-task task-id "f58349ae-4289-4f7c-b4ec-1c548be0a89a"
tasks:
- task-id: "f58349ae-4289-4f7c-b4ec-1c548be0a89a"
task-name: "MyMgmt - Test"
status: "in progress"
progress-percentage: 10
suppressed: false
comments: "In Progress..."
...
Which suggests that --sync false is designed only for install-policy and might not work for other API calls.
@Omer_Kleinstern at the very least we might want to update the docs for mgmt_cli to mention it is actually synchronous with install-policy.