I have a question about the best practice with a home linux box.
I recently install CentOS 5.6 on a machine I had lying around, and now I am using it by sshing into it from another machine. All that works fine, but the machine is turning off in the middle of the night. I think it is actually shutting down, or it could be sleeping, but when I push the power button, it boots afresh. I do not think this is a hardware issue.
I have tried two options:
- Logging in as root user to gnome and turning off all the power options. Screen saver, etc.
But if I just turn the monitor off and leave it on the desktop screen, the server eventually turns off.
- Leaving it on the initial login screen. This is the screen where you select kde, gnome, terminal, etc.
It also eventually turns off here too.
Thanks in advance for any advise as to how to prevent this. Again, I changed the gnome power settings to 'never' for everything but it does not seem to fix this issue.
A strange CentOS behaviour indeed. Have you checked the logs? This should be the first step to investigate the problem. First, try syslog:
Then dmesg for any ACPI events:
If you need just a remote terminal, then there is no need to keep x-server running. You can try killing it and see if the machine shuts down in this case.
Add a cron job writing a time stamp into the log every n (possibly n == 1) minutes? Will not help figure the reason, but it could help figure out if shutdown time is correlated with the time you leave your machine or it always turns off at the same time.
Another idea: move /sbin/shutdown to /sbin/shutdown.bin and create a shell script /sbin/shutdown which tells you what called shutdown, (find parent process id from $PPID, run ps auxwww to find out who's messing with the system, save pstree output and generally call the cavalry). This way you should be able to catch the offender red handed.