Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a script file which is run after a system crash when system starts. We need to run a special Database repair script if the server crashes (because of the power outage for example).

What would also help is some way of detecting a server crash at startup.


share|improve this question

migrated from Nov 20 '11 at 1:07

This question came from our site for professional and enthusiast programmers.

migrate to serverfault! migrate to serverfault! – MK. Oct 20 '11 at 21:28
What do you mean? – ddofborg Oct 21 '11 at 10:02
Sorry, my bad. Is there a way to move it? – ddofborg Oct 21 '11 at 17:34
nah, don't worry about it. I said if have jokingly, I dont like the site fragmentation too much, but this one is actually sort of ok to migrate. – MK. Oct 21 '11 at 20:00
up vote 2 down vote accepted

Gentoo has a directory /etc/local.d for scripts which will be run at system startup (if the filename ends with .start) and normal shutdown (if it ends with .stop). Off the top of my head I would suggest something like the following:

  • Create a .stop script which creates an empty file somewhere, to use as an indicator of a normal shutdown
  • Create a .start script which checks for the presence of the file and runs the DB repair script if it isn't found, or deletes it if it is found

I'm assuming that your database repair script won't cause any problems if it is run on an uncorrupted database.

share|improve this answer
This would be a good trick. Thanks. I was hoping for a /etc/crash.d or something. – ddofborg Oct 21 '11 at 10:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.