VMware Cloud Community
Winne2
Contributor
Contributor

crontab problem with .#root

Hi all!

I try to schedule the stutdown and start of a virtual machine on esxi5.

My problem is that if i macke any changes on  /var/spool/cron/crontabs/root file the esxi creates a new file called .#root and is using this file.

Also if i try over /etc/rc.local and restart the server there is the same problem.

rc.local creates the root file with the right settings, but also creates the .#root file without my modified settings and works with this.

Someone any idea?

I worked now for a hole day an cannot find a solution.

Has vmware did any changes here?

Thanks!

Harald

0 Kudos
7 Replies
Sreejesh_D
Virtuoso
Virtuoso

Follow the steps under the section "Configure on ESXi" in Cronjob FAQ @  http://communities.vmware.com/docs/DOC-8760.

The guide is for configuring getto, you can ignore the steps related to getto, just follow the cronjob related steps.

0 Kudos
Sreejesh_D
Virtuoso
Virtuoso

The VM power operations can be automated easily using vCenter Server. I'm sure you should aware of it, just quoting here if you are not.

0 Kudos
Winne2
Contributor
Contributor

I followed exactly this steps, but it doesn't work for me.

mv /var/spool/cron/crontabs/root.backup /var/spool/cron/crontabs/root

After this step i have 2 files, root and .#root

And cron is working with .#root

0 Kudos
Winne2
Contributor
Contributor

Yes i know.

But i have no vCenter Server....  😞

0 Kudos
Sreejesh_D
Virtuoso
Virtuoso

Try this http://www.jules.fm/Logbook/files/add_cron_job_vmware.html

1. Kill crond first.

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

2. Edit the file.

3. start crond.

busybox crond.

/bin/kill $(cat /var/run/crond.pid)
/bin/echo '5 0 * * * /full/path/to/script arguments/with/full/path > /full/path/to/logfile 2>&1' >> /var/spool/cron/crontabs/root
/bin/busybox crond

0 Kudos
Winne2
Contributor
Contributor

I did it exactly this way. But still the same shit.......

Capture.JPG

After i edit i have this .#root

0 Kudos
diondp
Contributor
Contributor

i know this is old, but some will probably find this thread...

the solution is to force write by this command:

VI Editor

Note: When using :wq to save your changes, you’ll likely get a warning that the file is read only. You don’t need to fiddle with the permissions. Simply use :wq! and the file will be written successfully.  

0 Kudos