1

We run VMWare vSphere 4.1, and VMWare Data Recovery 1.2. We have a weekly window with no backups happening, and due to some instabilities, we would like to try scheduling an automatic weekly reboot of the VMWare Data Recovery appliance.

More specific details: - VMWare Data Recovery 1.2 seems to be based on CentOS 5.2. - We use NFS for data storage. The appliance sees this as local storage, but the drive is actually stored in a different building. Seems to work great, and so far has been significantly faster and more stable than CIFS (which we used before).

I have tried scheduling the reboot using /etc/cron.d within the VDR appliance itself:

/etc/cron.d/sunday_reboot:

45 1     * * sun   /usr/local/bin/custom_reboot.sh >> /var/log/reboot.log

/usr/local/bin/custom_reboot.sh:

#!/bin/bash
/bin/echo "==================================="
/bin/date
/bin/echo "Rebooting server now."
/usr/bin/reboot

I also restarted crond, /etc/init.d/crond restart However, /var/log/reboot.log stays empty, and uptime shows that no reboot ever happened.

What am I missing?

UrkoM
  • 383
  • 4
  • 17

2 Answers2

1

Any reason you can't schedule the reboot outside of the OS, as detailed here? Reboot Virtual Machine every 20 minutes

JakeRobinson
  • 2,904
  • 18
  • 26
  • For some reason, I couldn't find any clear description of "shut down", and I was worried that it would be a hard shut down. From your link, it looks like "Shut down" is tidy. In that case, yes, this would be the best option. – UrkoM Apr 24 '12 at 07:44
0

The format of the file you created under /etc/cron.d is invalid. You missed the username field. So, try the following:

45 1     * * sun  root /usr/local/bin/custom_reboot.sh >> /var/log/reboot.log

Also, you need to check the permissions of the script you created and make sure it has execution permission x. This is to answer your question regarding the cron job.

Continuously rebooting a server is not a good idea. It would be really better to find the issue instead of just rebooting even when you are doing it weekly.

Khaled
  • 36,533
  • 8
  • 72
  • 99
  • I will give your suggestion a try. I think at some point I had "root" in there, but made no difference. I agree that rebooting a server regularly is not a good idea, but the VMWare Data Recovery is a commercial application, and it doesn't give a lot of information on what goes wrong. It just stops doing the scheduled backups, and I can't find anything that is misconfigured. It is a virtual machine itself, with a single purpose, so as long as this makes the backups happen reliably, that's all that matters. – UrkoM Apr 23 '12 at 07:47
  • Even when adding "root" there, it didn't work. It seems there is something in the crond that VMWare has running in VDR that doesn't look at "/etc/cron.d/". I got it to work by using "crontab -e", and creating the task for the root user, and not at the whole system level. But I'm going to change it to the solution suggested above. Somehow I didn't find it in my search. – UrkoM Apr 24 '12 at 07:46