I want to execute a certain script (resp. some commands) always at shutdown time.
Acording to some recommendation I (as root) created a (new) script file
/etc/rc.d/init.d/local-shutdown
with (e.g.) the following simplified content:
#!/bin/bash
rm -rf /tmp/*
and made it executable for all.
... but it is never executed.
Why not?
Peter
Why does this shutdown script not work?
-
- Posts: 10642
- Joined: 2005/08/05 15:19:54
- Location: Northern Illinois, USA
Re: Why does this shutdown script not work?
Better question:
Why do you think it should be?
Why do you think it should be?
Re: Why does this shutdown script not work?
Because I read it in a comment. Unfortunately I do not remember the exact web page.
So any other related suggestion?
So any other related suggestion?
Re: Why does this shutdown script not work?
There are better ways to clear /tmp at reboot - mainly making it tmpfs and then nothing on it survives a reboot. Or even creating its own LV and using /etc/crypttab with a random key so that it's reformatted every time you boot up.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Re: Why does this shutdown script not work?
Maybe there are better ways for this particular command.
However it was a simplified example from me for a before-shotdown command.
There are other commands resp more complex script I want to perform just before I shutdown.
So I am searching for a general way where (in which file/folder) I can put commands to let them automatically execute at shutdown.
So where is the intended place for them?
However it was a simplified example from me for a before-shotdown command.
There are other commands resp more complex script I want to perform just before I shutdown.
So I am searching for a general way where (in which file/folder) I can put commands to let them automatically execute at shutdown.
So where is the intended place for them?
Re: Why does this shutdown script not work?
I think you should make a symlink to that script from /etc/rc0.d/ and /etc/rc6.d/pstein wrote:I want to execute a certain script (resp. some commands) always at shutdown time.
Acording to some recommendation I (as root) created a (new) script file
/etc/rc.d/init.d/local-shutdown
Otherwise, you have the script but it is not invoked and shutdown or reboot.