lamw / ghettoVCB

ghettoVCB
MIT License
1.28k stars 364 forks source link

Issue with a space and brackets in datastore name #84

Open dansoftware opened 8 years ago

dansoftware commented 8 years ago

I get error /vmfs/volumes/datastore1 (3)/ghettoVCB/ghettoVCB.sh: eval: line 1: syntax error: unexpected "(" when I try to execute the following command: /vmfs/volumes/datastore1\ \(3\)/ghettoVCB/ghettoVCB.sh -g /vmfs/volumes/datastore1\ \(3\)/ghettoVCB/ghettoVCB.conf -l /vmfs/volumes/datastore1\ \(3\)/ghettoVCB/log/ghettoVCB.log -f /vmfs/volumes/datastore1\ \(3\)/ghettoVCB/vm-list.txt -c /vmfs/volumes/datastore1\ \(3\)/ghettoVCB/policies -d dryrun > /vmfs/volumes/datastore1\ \(3\)/ghettoVCB/log/ghettoVCB-backup-$(/bin/date +\%F_\%H-\%M-\%S).log 2>&1.

or "/vmfs/volumes/datastore1 (3)/ghettoVCB/ghettoVCB.sh" -g "/vmfs/volumes/datastore1 (3)/ghettoVCB/ghettoVCB.conf" -l "/vmfs/volumes/datastore1 (3)/ghettoVCB/log/ghettoVCB.log" -f "/vmfs/volumes/datastore1 (3)/ghettoVCB/vm-list.txt" -c "/vmfs/volumes/datastore1 (3)/ghettoVCB/policies" -d dryrun > "/vmfs/volumes/datastore1 (3)/ghettoVCB/log/ghettoVCB-backup-$(/bin/date +\%F_\%H-\%M-\%S).log" 2>&1

There is no such problem if the -f parameter is replaced with -m: /vmfs/volumes/datastore1\ \(3\)/ghettoVCB/ghettoVCB.sh -g /vmfs/volumes/datastore1\ \(3\)/ghettoVCB/ghettoVCB.conf -l /vmfs/volumes/datastore1\ \(3\)/ghettoVCB/log/ghettoVCB.log -m millenium -c /vmfs/volumes/datastore1\ \(3\)/ghettoVCB/policies -d dryrun 2>&1

Or if not to use symlinks in volumes' names: /vmfs/volumes/544b046f-e5625ec2-a958-0cc47a13cce8/ghettoVCB/ghettoVCB.sh -g /vmfs/volumes/544b046f-e5625ec2-a958-0cc47a13cce8/ghettoVCB/ghettoVCB.conf -l /vmfs/volumes/544b046f-e5625ec2-a958-0cc47a13cce8/ghettoVCB/log/ghettoVCB.log -f /vmfs/volumes/544b046f-e5625ec2-a958-0cc47a13cce8/ghettoVCB/vm-list.txt -c /vmfs/volumes/544b046f-e5625ec2-a958-0cc47a13cce8/ghettoVCB/policies -d dryrun > /vmfs/volumes/544b046f-e5625ec2-a958-0cc47a13cce8/ghettoVCB/log/ghettoVCB-backup-$(/bin/date +\%F_\%H-\%M-\%S).log 2>&1

Well, it seems to me that the issue is related with using a space and brackets in datastore name: datastore1 (3). Is there any hope that it can be fixed in source code of ghettoVCB.sh? I cannot rename the datastore. There are too many running VMs on it.

ffejtable commented 5 years ago

I had made some changes to the way the script handles VM names with various special characters (in particular parenthesis and square brackets). That change builds the vms_list file differently which I believe corrects this issue as well. I don't know if those changes has been merged to master, however. Let me know if you still need help.

ghost commented 5 years ago

Hi I have the same issue. I used the patch1 and vms with space and brackets are now backed up how ever
they are not read by the VM_BACKUP_ROTATION_COUNT and so the script fails to delete the oldest archive. Please help...!!