From: Jeffrey Goldberg on 10 Sep 2006 18:24 Malcolm wrote: >> >> The real question I have is: How, specifically, does the Mac >> determine whether or not a clean shutdown happened on power up? > If it was a clean shutdown the boot disk will be dismounted. In that case an "init 1" should do the job. The problem is that OS X 10.4.7 doesn't appear to actually have (or use) the init command (even though there's a man page for it). But it looks like launchctl shutdown may do the trick. Note that launchd was, I believe, introduced with 10.4. Anyway, I'll post this, close a few apps and give it a try. If you don't hear from me in a while, than I really had problems rebooting. -j -- Jeffrey Goldberg http://www.goldmark.org/jeff/ I rarely read top-posted, over-quoted or HTML posts My Reply-To address is valid.
From: Jeffrey Goldberg on 10 Sep 2006 18:38 Jeffrey Goldberg wrote: > But it looks like > > launchctl shutdown > > may do the trick. Anyway, I'll post this, close a few apps and give it a try. It seems to have shut off just enough things to make the system unusable, but doesn't cause user applications to shut down. This really ought to be a simple thing. -j -- Jeffrey Goldberg http://www.goldmark.org/jeff/ I rarely read top-posted, over-quoted or HTML posts My Reply-To address is valid.
From: Wayne C. Morris on 10 Sep 2006 19:10 In article <2006091011514470243-jollyroger(a)nullorg>, Jolly Roger <jollyroger(a)null.org> wrote: > The real question I have is: How, specifically, does the Mac determine > whether or not a clean shutdown happened on power up? It reads a flag that's stored on the disk. When anything on the disk is modified, the OS changes the flag to "dirty". When the disk is ejected cleanly, either manually or during a shutdown/restart, the OS sets the drive's flag to "clean". When the disk is mounted again, the OS checks the flag. If it's "dirty", the OS scans the disk and tries to fix any problems. After it fixes the disk, it marks it as "clean".
From: Jolly Roger on 10 Sep 2006 19:28 On 2006-09-10 18:10:56 -0500, "Wayne C. Morris" <wayne.morris(a)this.is.invalid> said: > In article <2006091011514470243-jollyroger(a)nullorg>, > Jolly Roger <jollyroger(a)null.org> wrote: > >> The real question I have is: How, specifically, does the Mac determine >> whether or not a clean shutdown happened on power up? > > It reads a flag that's stored on the disk. > > When anything on the disk is modified, the OS changes the flag to "dirty". > > When the disk is ejected cleanly, either manually or during a > shutdown/restart, the OS sets the drive's flag to "clean". > > When the disk is mounted again, the OS checks the flag. If it's > "dirty", the OS scans the disk and tries to fix any problems. After it > fixes the disk, it marks it as "clean". That's not the question I was asking - I guess I should have phrased it differently. Here's my *real* real question: How does the Mac PMU determine whether or not the last shutdown was a clean shutdown as opposed to a power failure? -- -JR
From: Jolly Roger on 10 Sep 2006 19:40 On 2006-09-10 17:38:04 -0500, Jeffrey Goldberg <nobody(a)goldmark.org> said: > Jeffrey Goldberg wrote: > >> But it looks like >> >> launchctl shutdown >> >> may do the trick. Anyway, I'll post this, close a few apps and give it a try. > > It seems to have shut off just enough things to make the system > unusable, but doesn't cause user applications to shut down. > > This really ought to be a simple thing. > > -j Yes. Welcome to my hell. : ( So rather than try to solve the "How to shut down partially, but just enough, without powering off" conundrum, I've resorted to trying to schedule a 'wakeorpoweron' power manager event 5 minutes from the current shutdown time. As a test, I created a cron job in root user to execute this every 5 minutes: expr `date "+%s"` + 300 | xargs -I secs date -r "secs" "+%m/%d/%y %H:%M:%S" | xargs -tI date sudo pmset schedule wakeorpoweron \"date\" That worked! But of course, it stacks up events in pmset's queue as time goes on. Not opimtal. So... I can test to see if the current shut down sequence is in response to a UPS by looking for the existence of the /etc/apcupsd/powerfail file: if [ -f /etc/apcupsd/powerfail ]; then STARTTIME=`date "+%s"` STARTTIME=`expr $STARTTIME + 300 | xargs -I secs date -r "secs" "+%m/%d/%y %H:%M:%S"` echo "${STARTTIME}" | xargs -tI date sudo pmset schedule wakeorpoweron \"date\" fi Now I just need to put this in just the right shutdown script in just the right place to have it execute on shutdown. Any suggestions? I tried /etc/rc.shutdown, but it seems that script isn't always reliably executed?! - don't ask me why. -- -JR
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: Training SpamAssassin Next: Recovered Files Curious About ? |