[GH-ISSUE #21] Exit Code #18

Closed
opened 2026-02-26 17:43:58 +03:00 by kerem · 7 comments
Owner

Originally created by @plant75 on GitHub (Sep 16, 2019).
Original GitHub issue: https://github.com/Corsinvest/cv4pve-autosnap/issues/21

Hello Daniele,
i have a strange result putting your great script inside a check script:
This is my routine:

if cv4pve-autosnap --host=127.0.0.1 --username=cv4pve@pve --password=xxx--vmid="all" snap --label='daily' --keep=15
then
echo "SNAP created"
else
notify "ERROR-SNAP-CVS"
exit 1
fi

When i put it on my crontab, i hav always the error exit code but the script was executed ..
Thanks!

Originally created by @plant75 on GitHub (Sep 16, 2019). Original GitHub issue: https://github.com/Corsinvest/cv4pve-autosnap/issues/21 Hello Daniele, i have a strange result putting your great script inside a check script: This is my routine: if `cv4pve-autosnap --host=127.0.0.1 --username=cv4pve@pve --password=xxx--vmid="all" snap --label='daily' --keep=15` then echo "SNAP created" else notify "ERROR-SNAP-CVS" exit 1 fi ---------------------------------------------- When i put it on my crontab, i hav always the error exit code but the script was executed .. Thanks!
kerem closed this issue 2026-02-26 17:43:58 +03:00
Author
Owner

@franklupo commented on GitHub (Sep 16, 2019):

I
can execute with --deb parameter and send me uoput?
Attention in the output is present the password.

Best regards

<!-- gh-comment-id:531730606 --> @franklupo commented on GitHub (Sep 16, 2019): I can execute with --deb parameter and send me uoput? Attention in the output is present the password. Best regards
Author
Owner

@plant75 commented on GitHub (Sep 16, 2019):

if cv4pve-autosnap --host=127.0.0.1 --username=cv4pve@pve --password=Azxd34Der455Xse --vmid="all" snap --label='daily' --keep=15 --deb
then
echo "SNAP CREATI"
else
echo "-->" $?
exit 1
fi

Output:
/etc/CV4.bash: line 27: Specify: command not found
--> 127

<!-- gh-comment-id:531736383 --> @plant75 commented on GitHub (Sep 16, 2019): if `cv4pve-autosnap --host=127.0.0.1 --username=cv4pve@pve --password=Azxd34Der455Xse --vmid="all" snap --label='daily' --keep=15 --deb` then echo "SNAP CREATI" else echo "-->" $? exit 1 fi --------------------------------------------------------------- Output: /etc/CV4.bash: line 27: Specify: command not found --> 127
Author
Owner

@franklupo commented on GitHub (Sep 16, 2019):

Sorry --debug and execute without if

<!-- gh-comment-id:531751945 --> @franklupo commented on GitHub (Sep 16, 2019): Sorry --debug and execute without if
Author
Owner

@franklupo commented on GitHub (Sep 19, 2019):

News?

<!-- gh-comment-id:533267659 --> @franklupo commented on GitHub (Sep 19, 2019): News?
Author
Owner

@plant75 commented on GitHub (Sep 20, 2019):

Without if something like this:

=============================
VM 109 consider enabling QEMU agent see https://pve.proxmox.com/wiki/Qemu-guest-agent
Phase: snap-create-pre
Create snapshot: autodaily190920102458
Method: GET, Url: https://127.0.0.1:8006/api2/json/nodes/testpve2/qemu/109/snapshot
StatusCode: OK
ReasonPhrase: OK
IsSuccessStatusCode: True
{
"data": [
{
"description": "cv4pve-autosnap",
"snaptime": 1568967876,
"name": "autodaily190920102436",
"vmstate": 0
},
{
"parent": "autodaily190920102436",
"name": "current",
"description": "You are here!",
"running": 0,
"digest": "51fe510f41da2171e148161e36f41baa769c3ae1"
}
]
}

Method: POST, Url: https://127.0.0.1:8006/api2/json/nodes/testpve2/qemu/109/snapshot
Parameters:
snapname : autodaily190920102458
description : cv4pve-autosnap
vmstate : 0
StatusCode: OK
ReasonPhrase: OK
IsSuccessStatusCode: True
{
"data": "UPID:testpve2:00005E3A:04077ECF:5D848CDA:qmsnapshot:109:cv4pve@pve:"
}

Method: GET, Url: https://127.0.0.1:8006/api2/json/nodes/testpve2/tasks/UPID:testpve2:00005E3A:04077ECF:5D848CDA:qmsnapshot:109:cv4pve@pve:/status
StatusCode: OK
ReasonPhrase: OK
IsSuccessStatusCode: True
{
"data": {
"exitstatus": "OK",
"starttime": 1568967898,
"pid": 24122,
"upid": "UPID:testpve2:00005E3A:04077ECF:5D848CDA:qmsnapshot:109:cv4pve@pve:",
"type": "qmsnapshot",
"node": "testpve2",
"status": "stopped",
"user": "cv4pve@pve",
"id": "109",
"pstart": 67600079
}
}

Method: GET, Url: https://127.0.0.1:8006/api2/json/nodes/testpve2/qemu/109/snapshot
StatusCode: OK
ReasonPhrase: OK
IsSuccessStatusCode: True
{
"data": [
{
"description": "cv4pve-autosnap",
"snaptime": 1568967876,
"name": "autodaily190920102436",
"vmstate": 0
},
{
"vmstate": 0,
"parent": "autodaily190920102436",
"snaptime": 1568967898,
"name": "autodaily190920102458",
"description": "cv4pve-autosnap"
},
{
"digest": "fc1d4c8e943aabe056afdc7713b832ee28429318",
"running": 0,
"parent": "autodaily190920102458",
"name": "current",
"description": "You are here!"
}
]
}

Phase: snap-create-post
Method: GET, Url: https://127.0.0.1:8006/api2/json/nodes/testpve2/qemu/109/snapshot
StatusCode: OK
ReasonPhrase: OK
IsSuccessStatusCode: True
{
"data": [
{
"description": "cv4pve-autosnap",
"vmstate": 0,
"parent": "autodaily190920102436",
"snaptime": 1568967898,
"name": "autodaily190920102458"
},
{
"description": "cv4pve-autosnap",
"vmstate": 0,
"name": "autodaily190920102436",
"snaptime": 1568967876
},
{
"digest": "fc1d4c8e943aabe056afdc7713b832ee28429318",
"running": 0,
"parent": "autodaily190920102458",
"name": "current",
"description": "You are here!"
}
]
}

Phase: snap-job-end

<!-- gh-comment-id:533459883 --> @plant75 commented on GitHub (Sep 20, 2019): Without if something like this: ============================= VM 109 consider enabling QEMU agent see https://pve.proxmox.com/wiki/Qemu-guest-agent Phase: snap-create-pre Create snapshot: autodaily190920102458 Method: GET, Url: https://127.0.0.1:8006/api2/json/nodes/testpve2/qemu/109/snapshot StatusCode: OK ReasonPhrase: OK IsSuccessStatusCode: True { "data": [ { "description": "cv4pve-autosnap", "snaptime": 1568967876, "name": "autodaily190920102436", "vmstate": 0 }, { "parent": "autodaily190920102436", "name": "current", "description": "You are here!", "running": 0, "digest": "51fe510f41da2171e148161e36f41baa769c3ae1" } ] } ============================= Method: POST, Url: https://127.0.0.1:8006/api2/json/nodes/testpve2/qemu/109/snapshot Parameters: snapname : autodaily190920102458 description : cv4pve-autosnap vmstate : 0 StatusCode: OK ReasonPhrase: OK IsSuccessStatusCode: True { "data": "UPID:testpve2:00005E3A:04077ECF:5D848CDA:qmsnapshot:109:cv4pve@pve:" } ============================= Method: GET, Url: https://127.0.0.1:8006/api2/json/nodes/testpve2/tasks/UPID:testpve2:00005E3A:04077ECF:5D848CDA:qmsnapshot:109:cv4pve@pve:/status StatusCode: OK ReasonPhrase: OK IsSuccessStatusCode: True { "data": { "exitstatus": "OK", "starttime": 1568967898, "pid": 24122, "upid": "UPID:testpve2:00005E3A:04077ECF:5D848CDA:qmsnapshot:109:cv4pve@pve:", "type": "qmsnapshot", "node": "testpve2", "status": "stopped", "user": "cv4pve@pve", "id": "109", "pstart": 67600079 } } ============================= Method: GET, Url: https://127.0.0.1:8006/api2/json/nodes/testpve2/qemu/109/snapshot StatusCode: OK ReasonPhrase: OK IsSuccessStatusCode: True { "data": [ { "description": "cv4pve-autosnap", "snaptime": 1568967876, "name": "autodaily190920102436", "vmstate": 0 }, { "vmstate": 0, "parent": "autodaily190920102436", "snaptime": 1568967898, "name": "autodaily190920102458", "description": "cv4pve-autosnap" }, { "digest": "fc1d4c8e943aabe056afdc7713b832ee28429318", "running": 0, "parent": "autodaily190920102458", "name": "current", "description": "You are here!" } ] } ============================= Phase: snap-create-post Method: GET, Url: https://127.0.0.1:8006/api2/json/nodes/testpve2/qemu/109/snapshot StatusCode: OK ReasonPhrase: OK IsSuccessStatusCode: True { "data": [ { "description": "cv4pve-autosnap", "vmstate": 0, "parent": "autodaily190920102436", "snaptime": 1568967898, "name": "autodaily190920102458" }, { "description": "cv4pve-autosnap", "vmstate": 0, "name": "autodaily190920102436", "snaptime": 1568967876 }, { "digest": "fc1d4c8e943aabe056afdc7713b832ee28429318", "running": 0, "parent": "autodaily190920102458", "name": "current", "description": "You are here!" } ] } ============================= Phase: snap-job-end
Author
Owner

@franklupo commented on GitHub (Sep 20, 2019):

Hi,
you are specify --vmid=all please send me all output

best regards

<!-- gh-comment-id:533511773 --> @franklupo commented on GitHub (Sep 20, 2019): Hi, you are specify --vmid=all please send me all output best regards
Author
Owner

@franklupo commented on GitHub (Sep 30, 2019):

News?

<!-- gh-comment-id:536437894 --> @franklupo commented on GitHub (Sep 30, 2019): News?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cv4pve-autosnap#18
No description provided.