Are rc.shutdown and rc.shutdown.local still usable on OS X Lion? Are either of rc.shutdown or rc.shutdown.local still being use in OS X, or have they been replaced with something else?  

I realize that launchd is replacing most of this, but I thought you could still use rc.shutdown.local to run a script.  

I couldn't even find rc.shutdown anywhere on my system.
I have no idea, really. There is a mention of /etc/rc.shutdown.local in /System/Library/LaunchDaemons/com.apple.SystemStarter.plist, but I am not at all sure what it means. The manual page for SystemStarter is not a great help, beyond informing us that it is deprecated. The program is running on my system, though. Oh, and the string /etc/rc.shutdown.local is found inside the SystemStarter binary as well. My guess is that files there will be run at shutdown. 

But if I may answer your implicit question of how to run something at shutdown: Here is what I have done. First, I wrote and compiled this little C program. What it does is simply to sleep until it receives a SIGTERM, at which point it exec's its arguments:

#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;unistd.h&gt;
#include &lt;signal.h&gt;

char **args;

void sigterm(int s) {
  execvp(args[1],args+1);
  fprintf(stderr, "%s: exec failed: ", args[0]);
  perror(args[1]);
  exit(1);
}

int main(int argc, char *argv[]) {
  args=argv;
  signal(SIGTERM,sigterm);
  for (;;) sleep(0x7FFFFFFF);
}


I have a launch daemon set up to run this program at startup. Come shutdown time, launchd will send the SIGTERM that causes the program to do its thing. Of course, it has to do so fairly quickly, or launchd will apply a bigger sledgehammer.

Here is my launchctl plist, named no.ntnu.math.hanche.quietboot.plist and placed in /Library/LaunchDaemons/. Its sole purpose is to run `nvram SystemAdioVolume=%01' at shutdown, so I can reboot without the chime.

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;no.ntnu.math.hanche.quietboot&lt;/string&gt;
    &lt;key&gt;ProgramArguments&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;/local/bin/atshutdown&lt;/string&gt;
        &lt;string&gt;/usr/sbin/nvram&lt;/string&gt;
        &lt;string&gt;SystemAudioVolume=%01&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;Disabled&lt;/key&gt;
    &lt;false/&gt;
    &lt;key&gt;KeepAlive&lt;/key&gt;
    &lt;false/&gt;
    &lt;key&gt;RunAtLoad&lt;/key&gt;
    &lt;true/&gt;
&lt;/dict&gt;
&lt;/plist&gt;