BTW, there is something that should always work with Tiger: an /etc/
rc.shutdown script.
I prefer to use launchd if possible.
First I thought maybe the network is down when my script receives
some of the above signals and I can not get the signals any more.
But I extended my script to write into a log-file when it
receives SIGINT, -HUP or -TERM. But there was nothing in the log-
file.
I searched for launchd and read the man pages. There is nothing
mention what happens when a system is shutdown. (BTW. The same
script works as expected running on a linux-box)
Could you show us a minimal sample script that reproduces the lack
of entries in the log?
Okay, I wrote a really simple script that pings a host every 30
seconds and when it gets a signal it should send a final ping. When
it receives the signal it writes into the log-file, but I get no ping
answer logged. I think the interfaces are already down when my script
wants to send the final ping.
I am going to change my script that is doing the real work maybe I
have a bug in it that it does not write anything into the log-file -
but I still have the problem that network is already down when my
script neds it for a final connection.
As well as the location and contents of the plist that you have
devised for having launchd to launch your script?
Okay here comes my little test-script and my plist-file (when I can
not find a bug in my real work-script I am going to post it also):
#!/bin/sh
RUNFOREVER=1
function script_exit {
/bin/echo "just got the signal to stop"
/sbin/ping -c 1 target.host.net
/bin/echo "ping done going to stop now"
exit
}
trap script_exit SIGHUP SIGINT SIGTERM
/bin/echo "starting up"
while [ $RUNFOREVER ]; do
/bin/sleep 30
/sbin/ping -c 1 target.host.net
/bin/echo "still working"
done
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://
www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>de.cunde.sigtest</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/sigtest.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>ServiceDescription</key>
<string>signals and launchd - will it work</string>
<key>StandardOutPath</key>
<string>/private/var/log/sigtest.log</string>
</dict>
</plist>
Every hint is welcome, thanks,
Christoph
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macos-x-server mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/macos-x-server/email@hidden