|
#1
| ||||
| ||||
| I have a command-line program I wrote in C that I need to be executed everytime the computer shuts down. On one of my friends computers there is a folder called rc (I think) in the /etc directory, and you can place programs in that and they will be executed at shutdown. Mac OS X however doesn't seem to have one of those. Alternatively, if there is no shutdown scripts folder in Mac OS X, which it looks like there isn't, I can just make my application sit idle until it recieves a signal from the computer that it is going to shutdown, and I could have it run when it recieves that signal. Does anyone know if Mac OS X sends such a signal, and if so how I would recognise it? This is my first post here. Hi everyone ![]() |
|
#2
| ||||
| ||||
| Try writing an Apple Script that runs your program, then shuts down your computer. Then, when you want to shut down, just launch this script.
__________________ System: 2.5 GHz MacBook Pro Core 2 Duo, 4 GB RAM, 200 GB hard drive, runs 10.5.4 1.6 GHz iMac G5, 1.5 GB RAM, 250 GB hard drive, runs 10.4.11 iPhone, 4 GB, OS X 2.0.2 |
|
#3
| |||
| |||
| create a logout-hook |
|
#4
| ||||
| ||||
| Oh thanks floris, I had seen the Loginhooks before but had then been told that there was no logout equivelant. Thanks for correcting me ![]() |
|
#5
| ||||
| ||||
| Yeah log* hooks are really cool. In a similar vein I have a little project of my own. I have a UPS (can't remember which off the top of my head but it's included OS X software is called PowerChute) into which is plugged BOTH my iMac-which has the USB connection-and my RedHat server. Now, I want to find a way to send a shutdown command to my RedHat server when my iMac goes down, but only when it goes down as a result of PowerChute telling it to; i.e., I don't want to reboot my server when my iMac restarts for softwareupdate. As far as I can see, PowerChute seems to have the halt hard-coded into the monitoring daemon (that is, there is no user-editable shutdown script that I can find and edit). Is there any easy solution to this problem?
__________________ michaelsanford.com Blog Twitter Tumblr LinkedIn iMac Aluminum 24" | MacOS X 10.5-current | 3.06 GHz Intel Core Duo | 4 GB RAM | 1 TB HDD iBook G4 1.42 GHz | MacOS X 10.5-current | 1 GB RAM, 100 GB HDD AMD Athlon64 3500+ | Slackware 12 (2.6.21.5-smp) | 2 GB RAM, 2120 GB RAID 1, 2500 GB RAID 0 |
![]() |
| Thread Tools | |
|
|