I need to backup some files every time I shutdown a Red Hat Enterprise Linux 4.
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 I have 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 there is any other better way to do this? Could work my own idea to make it?
2 Answers
I've answered this sort of question before (hint: search my previous answers; I'm on a mobile currently), but the problem you are likely facing is that an init script will not be shutdown if a the lock file has not been created (/var/lock/subsys/mything).
You can create this yourself for testing purposes, but the catch is you'll need to have this script run at startup too; just to at least create the lock.
Study something like the init script for crond
Cheers, Cameron
It looks like there is a configurable timeout value before the script is killed. See this answer.
ls -la /etc/rc0.d/
?