Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to run scripts at shutdown - how does launchd shutdown a system?



On 1/10/07 10:29, Christoph Ewering wrote:

Hello!

I run a simple script on a remote computer to connect my computer every 30 minutes. Now I want to extend the script to connect immediately and finally when the remote computer is shutting down.

So i setup a simple shell script with some trap handling for SIGHUP, SIGTERM, SIGINT and it works when I start it in a shell and send the right signals. But my script used to be started by launchd and at the moment it looks to me, that launchd did not send any signal to managed processes.


According to the docs, it should be sent a SIGTERM, then, if still alive after a few seconds, a SIGKILL.
But who knows, it seems that some flaws are still around, and perhaps have you just met one...


BTW, there is something that should always work with Tiger: an /etc/rc.shutdown script.

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?
As well as the location and contents of the plist that you have devised for having launchd to launch your script?


Axel
_______________________________________________
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

This email sent to email@hidden
References: 
 >how to run scripts at shutdown - how does launchd shutdown a system? (From: Christoph Ewering <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.