Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

I need to backup some files every time i will shutdown a Red Hat enterprise 4 Linux. I thought about make it with a script in /etc/rc0.d but shutdown process should wait for my script to finish. So the only idea is to make the script run first of all and stop shutdown process, then at the end of the script run shutdown again. Can anyone tell me if is there any other better way to do this? Could work my own idea to make it? Thanks.

share|improve this question
I don't really get the problem. The server will wait for the script to finish. Otherwise shutdown would occur for all other scripts in rc6.d (which is reboot, by the way. shutdown is rc0.d) before they have completed, leading to broken mysql databases etc. – etagenklo Jul 25 '13 at 9:59
Hi, My mistake rc6.d, i really mean rc0.d. About rc scripts it does not work for me. Maybe i´m doing wrong, but i put K01<name> script in rc0.d (linked from /etc/init.d/<name>) and it doesn´t work. The little script just try to make touch file after 120 seconds sleep. Are you sure shutdown process waits for all scripts in rc0.d? – Abraham Borbujo Jul 25 '13 at 10:39
Is your script exectutable (chmod +x)? What's the output of ls -la /etc/rc0.d/ ? – etagenklo Jul 25 '13 at 10:56
Yes is executable. – Abraham Borbujo Jul 25 '13 at 10:59
Yes is executable. Output is: lrwxrwxrwx 1 root root 17 Apr 23 17:52 K00abcwait -> ../init.d/abcwait – Abraham Borbujo Jul 25 '13 at 11:05

It looks like there is a configurable timeout value before the script is killed. See this answer.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.