Hi all
I'm trying to run a bash script via gaia_api but it doesn´t work
I'm using postman to do the POST
---------------https://192.168.32.20:443/gaia_api/login-------------------
[Headers]
[Body]
{
"user":"admin",
"password":"Thepassword"
}
[Response]
{
"api-server-version": "1.6",
"last-login-was-at": {
"iso-8601": "2022-06-08T17:50+2100",
"posix": 1654721424469
},
"read-only": false,
"session-timeout": 600,
"sid": "1113317833111169219182",
}
---------------https://192.168.32.20/gaia_api/v1.6/run-script-------------
[Headers]
content-Type application/json
x-chkp-sid 1113317833111169219182
[Body]
{
"script": "/home/admin/test.sh"
}
[Response]
{
"task-id": "39b288bc-b28e-4e0a-b8b0-31e641d39126"
}
--------------https://192.168.32.20/gaia_api/v1.6/show-task-------------
[Headers]
content-Type application/json
x-chkp-sid 1113317833111169219182
[Body]
{
"task-id": "39b288bc-b28e-4e0a-b8b0-31e641d39126"
}
[Response]
{
"tasks": [
{
"execution-time": "0.02",
"last-update-time": "2022-06-09T12:54+2100",
"progress-description": "succeeded",
"progress-percentage": 100,
"start-time": "2022-06-09T12:54+2100",
"status": "succeeded",
"status-code": 200,
"task-details": [
{
"error": "",
"output": "",
"return-value": 0
}
],
"task-id": "39b288bc-b28e-4e0a-b8b0-31e641d39126",
"task-name": "/run-script",
"time-spent-in-queue": "0.00"
}
]
}
--------------test.sh------------------------------------------------------
[test.sh]
#/bin/bash
date >> va.txt
-rwxrwxrwx 1 admin root 26 Jun 8 17:21 test.sh
This script works if is executed via CLI
It's an example, the real script is more complex
-------------------------GAIA API Reference example---------------------
POST {server}/v1.6/run-script
Content-Type: application/json
X-chkp-sid: {{session}}
{
"script": "date > /home/admin/run_script_example;echo Done"
}
This example works fine
--------------------Environment------------------------------------------
GAIA R81.10 MGMT
JHF 55
API Version 1.6