Re: How to tell if system shutdown is in process
Re: How to tell if system shutdown is in process
- Subject: Re: How to tell if system shutdown is in process
- From: Antoine Missout <email@hidden>
- Date: Tue, 22 Mar 2011 20:12:04 -0400
Check this:
http://stackoverflow.com/questions/1321219/receiving-power-notifications-especially-shutdown-on-mac-osx
- Antoine
On 2011-03-22, at 18:45, Jerry Krinock wrote:
> I have a command-line tool which can be started automatically by launchd. Sometimes, it can start a task which takes about 30 seconds, and if this happens while the system is being shut down, it may be killed before the task completes, causing unexpected results.
>
> In the man page for shutdown, I read:
>
> "Upon shutdown, all running processes are sent a SIGTERM followed by a SIGKILL. The SIGKILL will follow the SIGTERM by an intentionally indeterminate period of time. Programs are expected to take only enough time to flush all dirty data and exit."
>
> Fair enough. However, I'd like to know as early as possible when shutdown has commenced, so I can avoid starting any long-winded tasks. If all running processes receive this SIGTERM quickly upon shutdown commencement, then I think that installing a signal handler for SIGTERM would be an optimal solution.
>
> Do all running processes receive this SIGTERM quickly upon shutdown commencement?
>
> If, on the other hand, SIGTERM messages are sent to processes randomly over many seconds, is there any other way I could get a leg up by checking to see if the system is currently in the process of shutting down?
>
> Thanks,
>
> Jerry Krinock _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Darwin-kernel mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden