Link to home
Create AccountLog in
Avatar of NytroZ
NytroZFlag for United States of America

asked on

Auto Restart Red Hat Server

I would like to automatically restart my Red Hat servers every Saturday at midnight for a short time while the developers can figure out an issue we are experiencing with memory.  The Red Hat servers are virtual machines on ESXi 4.  Is there a method to create this schedule either through Red Hat or VMware?
Avatar of Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Flag of United Kingdom of Great Britain and Northern Ireland image

Do you have vCenter Server?
Avatar of NytroZ

ASKER

Yes
You can schedule reboot using cronjob in Redhat -

crontab -e
0 0 * * 6 /sbin/reboot
:wq
crontab -l
ASKER CERTIFIED SOLUTION
Avatar of Frosty555
Frosty555
Flag of Canada image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Schedule a Task Option in VMware vCenter Server.
You need a system memory dump, not the reboot.
Can you describe the issue of memory?
As gheist points out, to resolve an issue you need as much data as possible to identify the cause.
Sounds that you have a memory leak.  One thing to check if you use database scripts, that you open and close connections rather than leaving connections open.
What symptoms do you have?

Lsof is a good tool to see whatis going on the system.
Do you see the file system fill up without a file that corresponds to the amount of data such that upon reboot, the filesystem space returns to normal?

This type of an issue is a consequence of a process that creates and writes into a file that was deleted. I.e. filesystem no longer has a file reference but the process keeps writing into the file descriptor.  Stop the process, and the filesystem releases the space.
For memory leak you can enable psacct. That gives some idea regarding trends over time.
You can also dump particular process leaving it running.
You can use cgroups to swap offending applications first and leave rest of system that does not have memory leaks at full speed (RHEL6 required)
Say e.g. java will grow until something like 1G + Xmx+10% over time, even it starts and runs for a day with 64MB allocated...
To lesser extent same applies to apache, all databases like oracle or mysql or whatever etc
cmon you just drop a script you want weekly in /etc/cron.weekly and it will kick off whenever /etc/anacrontab wants it to
Thats the RHEL way (but you went posix way which is also good)