Re: VE not rebooting [message #16018 is a reply to message #16016] |
Sat, 18 August 2007 20:34   |
 |
dowdle
Messages: 261 Registered: December 2005 Location: Bozeman, Montana
|
Senior Member |
|
|
Greetings,
Ok... I have to admit, I hadn't learned anything about this until you asked... so I played with it and I believe I understand how it works now.
Whenever the vz service starts up it copies /etc/vz/cron/vz to /etc/cron.d/vz (as the comments in /etc/vz/cron/vz indicate). Whenever the vz service is stopped, it removes the /etc/cron.d/vz file. The contents of the /etc/cron.d/vz reveal that it will run ever 5 minutes.
If you run reboot as root inside of a VPS it will do two things:
1) create a file named reboot on the root directory. The file doesn't contain anything but it is just the fact that it exists that is significant
2) shuts down the vps
Then from the host node, the vz script that is running from cron every five minutes looks into the private directories for all of the VPSes and if it sees a file named reboot, it'll start the VPS back up... which basically simulates a reboot of the VPS.
So I tried it.
I ran reboot in a VPS. That stopped it and sure enough /vz/private/VEID/reboot existed. I checked /var/log/cron to see when the last time the vz cronjob had run... and then at the five minute mark after it last ran, it did indeed start the VPS back up.
How long it takes to restart the VPS depends on where within the 5 minute cycle the VPS stopped and created the reboot file.
If you are waiting 5 minutes and it still isn't restarting the VPS, it isn't acting as it is supposed to... but the comment has been made in the other thread you mentioned... that some VPS OS templates don't seem to have that functionality setup correctly... and may not remove the reboot file... or may not create it to begin with. It all depends on the OS Template the VPS was made with I guess.
Knowing how it works though will allow you to figure out what is going on. After the VPS has stopped... is there a 0 byte file named reboot in the root directory of the VE's private directory? Does it restart if you wait at least 5 minutes after the previous run of the cron vz script? Does it clear the reboot file from the VE's private directory after it restarts?
--
TYL, Scott Dowdle
Belgrade, Montana, USA
[Updated on: Sat, 18 August 2007 20:36] Report message to a moderator
|
|
|