Getting a script to run at shutdown

I want to have a script run when (i.e. just before :-) my machine shuts down.
Nollaig MacKenzie wrote on :

I want to have a script run when (i.e. just before :-) my machine shuts down. That was easy in Slackware Linux, but I haven't been able to figure out how to do it in OSX. Can anyone give me a quick hint?

Be nice if cron had something complementary to '@redacted.invalid'.

Cheers, N.

Hans Aberg replied on :

In article tkium2-9b5.ln1@redacted.invalid, nollaig@redacted.invalid wrote:

I want to have a script run when (i.e. just before :-) my machine shuts down. That was easy in Slackware Linux, but I haven't been able to figure out how to do it in OSX. Can anyone give me a quick hint?

Be nice if cron had something complementary to '@redacted.invalid'.

Does what the system logs write at shutdown not give any hints?