VMware Cloud Community
Krax
Contributor
Contributor
Jump to solution

Cron failed when i execute ghettoVCB.sh

Hi all,

ghettoVCB.sh runs correctly when i execute manually but when i execute like a cron it doesn't run :

  1. crontab -l

32 18 22 1 * /tmp/ghettoVCB.sh /tmp/backup_vms > /tmp/LOG_Backup.log 2>&1

                                1. Taking backup snapshot for DACDCU01_BACKUP ... ################

/tmp/ghettoVCB.sh: line 202: vmkfstools: command not found -


> ???????

Removing snapshot from DACDCU01_BACKUP ...

                                        1. Completed backup for DACDCU01_BACKUP! ####################

Start time: Thu Jan 22 16:33:01 CET 2009

End time: Thu Jan 22 16:33:09 CET 2009

Duration : 8 Seconds

Completed backing up specified Virtual Machines!

What's the mistake?

Tanks a lot .

0 Kudos
1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager
Jump to solution

FYI this was actually fixed few weeks back (check out the change log) and the latest version of the script is available at:

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

View solution in original post

0 Kudos
7 Replies
lamw
Community Manager
Community Manager
Jump to solution

When setting up your cron entry you'll want to specify the full path to "vmkfstools" as you can see the issue is the system is unable to find vmkfstools. You can do a quick search online if you have further questions about setting up a crontab entry.

=========================================================================

--William

VMware ESX/ESXi scripts and resources at:

0 Kudos
Lightbulb
Virtuoso
Virtuoso
Jump to solution

Take a look here for more info on the limitations of cron when running scripts.

http://blog.spikesource.com/crontab.htm

as lamw said the easiest way to fix is configure absolute paths in the script.

0 Kudos
mylesw
Contributor
Contributor
Jump to solution

I see that a lot of Windows users are remotely controlling ghettoVCB with tools like plink to remotely login and fire off the scripts. If one didn't want to use a local cron to do this on the VM host machine, but wanted to have it managed from an external Linux computer, what tools are available in Linux that would allow a remote machine to connect to the SSH shell and remotely fire off the ghettoVCB script?

Myles

0 Kudos
Krax
Contributor
Contributor
Jump to solution

My own solution Smiley Happy

1-) In the script ghettoVCB.sh there are two lines referencing vmkfstools; Change including the complete path : /usr/sbin/vmkfstools -i. Something like that:

VMDK="$"

if ; then

/usr/sbin/vmkfstools -i "$/$" -d 2gbsparse "$/$" else /usr/sbin/vmkfstools -i "$/$" "$/$"

fi

done

$ vmsvc/snapshot.remove $ > /dev/null 2>&1

2-) Create the cron:

crontab -e

#Execute backup everyday (monday to friday) at 23:30 reporting a log "LOG_HOT_Backup.log "

30 23 * * 1-5 sh /backup_script/ghettoVCB.sh /backup_script/backup_vms >> /backup_script/LOG_HOT_Backup.log 2>&1

Thanks.

0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

FYI this was actually fixed few weeks back (check out the change log) and the latest version of the script is available at:

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
Krax
Contributor
Contributor
Jump to solution

Thanks for your information.

0 Kudos
NexusGuy59
Contributor
Contributor
Jump to solution

I have a question, no one has been able to answer.I run ghettoVCB via cron on my ESXi server and it started running this morning I noticed it is still running (not ghettoVCB). Now I know that it failed because I had snapshots already present however my log file is filling up and it’s not letting me stop the process that is running. I thought it would be ghettoVCB, however it is not ghettoVCB after ps aux | grep ghettoVCB low and behold it doesn’t show up in the output. So I need to know and identify which process is still running the backup syquence and kill it, anyone have any ideas at all?

Thanks,

0 Kudos