Hi,
I have an error when I want to restore a vm with a script launch by crontab.
This script works well when I start it from command line but not in the crontab.
When I start it manually (# /bin/tcsh /ga/scripts/restore.tcsh -vms 101 -vmd 201), I don't have any error and all is fine!
When I set an entry in crontab like this : "40 11 * * 5 /bin/tcsh /ga/scripts/restore.tcsh -vms 101 -vmd 201" -> it doesn't work
I don't know why zcat can't work when it have been launch from crontab.
The script starts well but stop with is error :
restore vma archive: zcat /mnt/pve/backup/dump/vzdump-qemu-101-2013_09_04-00_01_02.vma.gz|vma extract -v -r /var/tmp/vzdumptmp381449.fifo - /var/tmp/vzdumptmp381449
CFG: size: 379 name: qemu-server.conf
DEV: dev_id=1 size: 53687091200 devname: drive-virtio0
CTIME: Wed Sep 4 00:01:04 2013
TASK ERROR: command 'zcat /mnt/pve/backup/dump/vzdump-qemu-101-2013_09_04-00_01_02.vma.gz|vma extract -v -r /var/tmp/vzdumptmp381449.fifo - /var/tmp/vzdumptmp381449' failed: got timeout
This is my script :
restorevm.tcsh
#!/bin/tcsh
if ($#argv < 1) then
/bin/echo "ERREUR SUR LE NOMBRE D'ARGUMENTS"
/bin/echo "usage : $0 -vms original vmid -vmd destination id"
exit 1
endif
# Parse Args
@ i = 1
while ($i <= $#argv)
switch($argv[$i])
case "-vms":
@ i++
set VMIDS = "$argv[$i]"
breaksw
case "-vmd":
@ i++
set VMIDD = "$argv[$i]"
breaksw
default:
breaksw
endsw
@ i++
end
echo $VMIDS
echo $VMIDD
# Exemple de commande finale : qmrestore -force 1 /mnt/pve/backup/dump/vzdump-qemu-101-2013_06_25-14_49_53.vma.lzo 201
set BACKUP = `ls -t /mnt/pve/backup/dump/vzdump*.vma.gz |grep $VMIDS |head -1`
echo $BACKUP
/usr/sbin/qmrestore -force 1 --storage local $BACKUP $VMIDD
Do you have any idea?
Thank you in advance
I have an error when I want to restore a vm with a script launch by crontab.
This script works well when I start it from command line but not in the crontab.
When I start it manually (# /bin/tcsh /ga/scripts/restore.tcsh -vms 101 -vmd 201), I don't have any error and all is fine!
When I set an entry in crontab like this : "40 11 * * 5 /bin/tcsh /ga/scripts/restore.tcsh -vms 101 -vmd 201" -> it doesn't work
I don't know why zcat can't work when it have been launch from crontab.
The script starts well but stop with is error :
restore vma archive: zcat /mnt/pve/backup/dump/vzdump-qemu-101-2013_09_04-00_01_02.vma.gz|vma extract -v -r /var/tmp/vzdumptmp381449.fifo - /var/tmp/vzdumptmp381449
CFG: size: 379 name: qemu-server.conf
DEV: dev_id=1 size: 53687091200 devname: drive-virtio0
CTIME: Wed Sep 4 00:01:04 2013
TASK ERROR: command 'zcat /mnt/pve/backup/dump/vzdump-qemu-101-2013_09_04-00_01_02.vma.gz|vma extract -v -r /var/tmp/vzdumptmp381449.fifo - /var/tmp/vzdumptmp381449' failed: got timeout
This is my script :
restorevm.tcsh
#!/bin/tcsh
if ($#argv < 1) then
/bin/echo "ERREUR SUR LE NOMBRE D'ARGUMENTS"
/bin/echo "usage : $0 -vms original vmid -vmd destination id"
exit 1
endif
# Parse Args
@ i = 1
while ($i <= $#argv)
switch($argv[$i])
case "-vms":
@ i++
set VMIDS = "$argv[$i]"
breaksw
case "-vmd":
@ i++
set VMIDD = "$argv[$i]"
breaksw
default:
breaksw
endsw
@ i++
end
echo $VMIDS
echo $VMIDD
# Exemple de commande finale : qmrestore -force 1 /mnt/pve/backup/dump/vzdump-qemu-101-2013_06_25-14_49_53.vma.lzo 201
set BACKUP = `ls -t /mnt/pve/backup/dump/vzdump*.vma.gz |grep $VMIDS |head -1`
echo $BACKUP
/usr/sbin/qmrestore -force 1 --storage local $BACKUP $VMIDD
Do you have any idea?
Thank you in advance