VMware Cloud Community
louis00
Contributor
Contributor

cron job on ESXi 4.1

hi all,

i have been trying to put together a cron job to automatically backup my vm's using ghettovcb.sh

i have follow every instruction as per http://communities.vmware.com/docs/DOC-8760

the backup ran successfully if i initiate it manually. but the cronjob is not.

here is a copy of my root file

/var/spool/cron/crontabs # cat root
#syntax : minute hour day month dayofweek command
01 01 * * * /sbin/tmpwatch.sh
01 * * * * /sbin/auto-backup.sh #first minute of every hour (run every hour)
0 0 * * 0 /vmfs/volumes/datastore1/ghettoVCB.sh -f /vmfs/volumes/datastore1/vms_to_backup

/etc # cat /var/run/crond.pid
17196470
/etc # ps | grep busybox
4446 4446 busybox              syslogd
4940 4940 busybox              inetd
17196470 17196470 busybox              busybox

I thought i suppose to see 17196470 busybox crond

just wondering has anyone got crond working? if do, please point out my mistakes. Thank you.

Reply
0 Kudos
6 Replies
johnwilk
Contributor
Contributor

This will not work on ESX4.1 as VMware have "tinkered" to break ghettoVCB scripts from running. That doesn't necessarily meant that you cant get it to work through other means though if you know what you are doing Smiley Wink

louis00
Contributor
Contributor

some pointers please Smiley Happy

thank you.

Reply
0 Kudos
DSTAVERT
Immortal
Immortal

There are lots of references in the ghettoVCB DOC that you posted. Any further questions should be directed there.

-- David -- VMware Communities Moderator
Reply
0 Kudos
codecrank
Contributor
Contributor

I'm running esxi 4.1 , I had to monkey around to get cronjobs working.

I see "busybox crond"  when i do a  "ps | grep cron"

odd that yours doesn't but /var/run/crond.pid should be correct , try killing that pid , ( process at your own risks here Smiley Happy )

in my case , after I edit the root crontab and I kill cron, I can't start it back buy calling "busybox crond". I had to:

ln -s /bin/busybox /bin/crond

/bin/crond

In order for this to survive a reboot , I just added in my rc.local  ( example job )

/bin/kill $(cat /var/run/crond.pid)

echo '* * * * * touch /tmp/aa' >> /var/spool/cron/crontabs/root

ln -s /bin/busybox /bin/crond

/bin/crond

Then I ran the /sbin/auto-backup.sh

Hope this helps !

-Dan

Reply
0 Kudos
johnwilk
Contributor
Contributor

Louis00,

It would appear that /busybox crond no longer works. However. just executing crond does. So, to survive a reboot - in your rc.local script, instead of entering  /bin/busybox crond just enter crond and reboot. Works for me....

Looks like Dan's process might also work.

Smiley Wink

Reply
0 Kudos
TiloVM
Contributor
Contributor

Hi,

I ran into a issue with many crond running and messing up with my backup. (failed to acquire lock, another instance of script may be running, giving up on /tmp/ghettoVCB.lock)

see here.

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

starting via

busybox crond  gets me a

busybox              busybox

process

Startig via

/bin/busybox crond

got me a

busybox              /bin/busybox

so best is probable to use the crond as you get the desired:

busybox              crond

so ps | grep busy | grep -v grep  should only show the following three busybox processes

~ # ps | grep busy | grep -v grep
4398 4398 busybox              syslogd
4875 4875 busybox              inetd
5440 5440 busybox              crond
~ #

Thanks

Reply
0 Kudos