VMware Cloud Community
cliffordc
Contributor
Contributor

ghettoVCBg2 and Crontab Issue

Hey guys I have ghettoVCBg2 running fine on my VMA 4.1 machine, so now I decided it was time to automate the backups.

I followed all the instructions I could find wrt Crontab.

Basically I do the following commands:

sudo vi /etc/crontab

so the crontab looks like this:

SHELL=/bin/bash

PATH=/sbin:/bin:/usr/sbin:/usr/bin

MAILTO=root

HOME=/

# run-parts

01 * * * * root run-parts /etc/cron.hourly

02 4 * * * root run-parts /etc/cron.daily

22 4 * * 0 root run-parts /etc/cron.weekly

42 4 1 * * root run-parts /etc/cron.monthly

44 15 * * *  root /home/vi-admin/ghettoVCBg2.pl --vmlist /home/vi-admin/vmlist

I check the cron jobs with

sudo tail -f /var/log/cron

I see the command running, but nothing happens, no logs are written, and no backups are taken.

If I copy exactly the command  /home/vi-admin/ghettoVCBg2.pl --vmlist /home/vi-admin/vmlist and run it normally it works fine.

This has been eating weeks out of my time trying to figure out why.

Any ideas?

0 Kudos
5 Replies
lamw
Community Manager
Community Manager

Try re-directing the output in the crontab to see what errors you're getting or enable logging from the script, you won't see much from /var/log/cron other than it executing or not.

0 Kudos
cliffordc
Contributor
Contributor

Thanks for your help but I have tried redirecting the output to a file.  The log file is created but is blank.

It appears that the script isn't running as there is no ghettoVCBg2.log created in /tmp

0 Kudos
awliste
Enthusiast
Enthusiast

William talked me through mine. Turns out error was between keyboard and floor.

Here's what worked for me:

http://communities.vmware.com/thread/289177/

Good Luck!

- Abe

Integritas! Abe Lister Just some guy that loves to virtualize ============================== Ain't gonna lie. I like points. If what I'm saying is something useful to you, consider sliding me some points for it!
0 Kudos
cliffordc
Contributor
Contributor

awliste thanks for your reply, looking through the post you linked has sorted the issue.

When I added the LD_LIBRARY_PATH=  line it worked.

Thanks agian for your help.

0 Kudos
snsh
Contributor
Contributor

I had same problem (cron runs, nothing happens).   Fixed it by prepending LD_LIBRARY_PATH to the cron job.  So crontab -l did not work with this:

30 19 * * 1-5 /home/vi-admin/ghettoVCBg2.pl --vmlist /home/vi-admin/virtual_machine_backup_list.txt

but does work with this:

30 19 * * 1-5 LD_LIBRARY_PATH=:/opt/vmware/vma/lib64:/opt/vmware/vma/lib /home/vi-admin/ghettoVCBg2.pl --vmlist /home/vi-admin/virtual_machine_backup_list.txt

This isn't mentioned in the ghettoVCBg2 docs.  I wonder if something changed in vMA 4.1.

0 Kudos