VMware Cloud Community
SirJayDee
Contributor
Contributor
Jump to solution

Problem to execute script from cron

I have a script that i would like cron to execute every day and it works fine if I logon to the vMA and execute it from the command line, but cron just throws back "Server version unavailable at ... /usr/lib/perl5/5.10.0/VMware/VICommon.pm line 545". And the thing is, it worked fine for cron too before we updated the vMA to 5.0.0.1 Build 643553.

Any ideas how to solve this?

1 Solution

Accepted Solutions
3 Replies
VTsukanov
Virtuoso
Virtuoso
Jump to solution

SirJayDee
Contributor
Contributor
Jump to solution

That did the trick, thank you very much! Smiley Happy

0 Kudos
ChrisHaag
Enthusiast
Enthusiast
Jump to solution

To make this thread better searchable by Google and help other with the issue here are some add ons:


1) Backup of ESXi host settings

We use a small bash script to back up VMware ESXi host settings. The script uses the vicfg-cfgbackup command.

Since the upgrade from vMA 5.0.0.0 to 5.0.0.1 it cannot be executed through cron. The error mesage is the same as for the original poster, it's "Server version unavailable at 'https://myserver.domain.local:443/sdk/vimService.wsdl' at /usr/lib/perl5/5.10.0/VMware/VICommon.pm line 545"

The solution is the same. Inside a bash script the environment variable needs to be set with


export PERL_LWP_SSL_VERIFY_HOSTNAME=0

2) Backup VMs using ghettoVCBg2 (ghetto)

The error message when executed through a cron job is different, it's "error: getFinalList ERROR – Unable to locate VM".

The fix is the same. For your convenience here's the little wrapper script we use to call the backup with ghetto from a cron job:

#!/bin/bash

export PERL_LWP_SSL_VERIFY_HOSTNAME=0

source /etc/bash.bashrc

cd /home/vi-admin/

/home/vi-admin/ghetto/ghettoVCBg2.pl --vmlist /home/vi-admin/ghetto/my_vm_list

Christian

0 Kudos