Corsinvest / cv4pve-autosnap

Automatic snapshot tool for Proxmox VE
https://www.corsinvest.it/cv4pve
GNU General Public License v3.0
402 stars 50 forks source link

cv4pve in /etc/cron.d , won't auto start #32

Closed changchichung closed 4 years ago

changchichung commented 4 years ago

OS: debian 9 PVE Version: pve-manager/5.4-10/9603c337 cv4pve version: 1.7.2

I changed backup method from eve4pve to cv4pve couple days ago. using the same way , add a file in /etc/cron.d , with almost the same content , except the snapshot command. but cv4pve wont take snapshot at the specified time in crontab. I have no idea why . I could run the command in prompt without problems , but it just won' start in crontab

here is /etc/cron.d/cv4pve-autosnap

2020-04-17 11:19:46 [root@hqs030 ~]$ cat /etc/cron.d/cv4pve-autosnap 
MAILTO="changch@abc.com"
#ansible
0 2 * * * root cv4pve-autosnap --host 192.168.1.30 --username root --password rootpassword --vmid 101 snap --keep 7 --label "_kw_ansible_"
#build
0 3 1 * * root cv4pve-autosnap --host 192.168.1.30 --username root --password rootpassword --vmid 100 snap --keep 3 --label "_kw_build_"
2020-04-17 11:22:12 [root@hqs030 ~]$

in /var/log/cron.log , it shows the command already been executed.

Apr 16 23:00:01 hqs030 CRON[23813]: (root) CMD (tar czvf "/usr/local/backup/pve_\$(date '+%Y-%m-%d').tgz" /etc/pve)
Apr 17 02:00:01 hqs030 CRON[5722]: (root) CMD (cv4pve-autosnap --host 192.168.1.30 --username root --password rootpassword --vmid 101 snap --keep 7 --label "_kw_ansible_")

but pve didnt see the sanpshot.

2020-04-17 11:24:56 [root@hqs030 cron.d]$ qm listsnapshot 101
`-> init_ansiblecontrol         2019-07-15 10:15:17     no-description
    `-> before_upgrade_ansible_to_27 2019-07-19 11:29:56     no-description
`-> auto_kw_ansible_200415110438 2020-04-15 11:04:39     cv4pve-autosnap
    `-> current                                         You are here!
2020-04-17 11:25:37 [root@hqs030 cron.d]$ 

any suggestions ??

franklupo commented 4 years ago

Hi, if you use the command line does it work?

changchichung commented 4 years ago

yes. it works.

2020-04-17 14:50:34 [root@hqs030 ~]$ cat /etc/cron.d/cv4pve-autosnap 
MAILTO="changch@abc.com"
#ansible
0 2 * * * root cv4pve-autosnap --host 192.168.1.30 --username root --password rootpassword --vmid 101 snap --keep 7 --label "_kw_ansible_"
#build
0 3 1 * * root cv4pve-autosnap --host 192.168.1.30 --username root --password rootpassword --vmid 100 snap --keep 3 --label "_kw_build_"
2020-04-17 14:50:38 [root@hqs030 ~]$ cv4pve-autosnap --host 192.168.1.30 --username root --password rootpassword --vmid 101 snap --keep 7 --label "_kw_ansible_"
ACTION Snap 
VMs:   101  
Label: _kw_ansible_ 
Keep:  7 
State: False
----- VM 101 -----
VM 101 consider enabling QEMU agent see https://pve.proxmox.com/wiki/Qemu-guest-agent
Create snapshot: auto_kw_ansible_200417145051
2020-04-17 14:51:30 [root@hqs030 ~]$ 
franklupo commented 4 years ago

The new version using Api web. Which user do you use? Permission Problem?

changchichung commented 4 years ago

root , should not be permission problem.

franklupo commented 4 years ago

Paths?

changchichung commented 4 years ago

yes , it's related to the path , I put cv4pve-autosnap in /usr/local/bin , but debian 9 search in /usr/local/sbin by deault .

franklupo commented 4 years ago

Hi, remember that this version can be run externally to Proxmox VE.

Best regards