OS X Server v10.5.8 - Won't Sleep Automatically

==Challenge
I need to have a server asleep most of the time, only waking up to serve the occasional web page/WebDav/FTP request  (will use knockd + WOL to wake server).  

==Problem
Right now the server will not sleep automatically when idle.

==Set-up / Config
I have a "standard configuration" OS X Server v10.5.8 running on an Intel Mac Mini Core Duo 1.66GHz 2Gb RAM.  

This is a clean install - I have not yet loaded any 3rd party applications, drivers, etc.

I have reset the NVRAM, PRAM, and SMC.

 I have no services running (no webservices, no AFP, etc. etc., i.e no green lights in Server Preferences.  I also clicked off all the check boxes for all the services in Server Admin -> Services)  (Earlier I had noticed in the logs that the AFP service seemed to be waking the machine up periodically - so I turned of AFP and all the other services just to eliminate this potential - obviously eventually I want the WebServices and FTP to keep the machine awake if they are responding to requests)

I do have wake on LAN enabled - which based on my requirements is mandatory.

I can choose sleep from the Apple menu and the computer sleeps and stays asleep OK and wakes without problem.

The display will turn off as per the settings in Energy Saver system preference.

But the computer will not sleep based on the settings in Energy Saver.

There are no relevent errors in the logs I can see (can post if useful).

Using pmset in terminal:
   public-24devon:~ admin$ pmset -g
   Active Profiles:
   AC Power            -1*
   Currently in use:
    sleep            4
    displaysleep      4
    autorestart      1
    hibernatefile      /var/vm/sleepimage
    hibernatemode      0
    powerbutton      1
    womp            1
    disksleep                           10
    ttyskeepawake      1

==What I've tried
1. I tried to setting ttyskeepawake to 0 using sudo, and while pmset -g showed the new value the computer wouldn't sleep.

2. Oddly, after turning on the screen saver, and manually invoking it (via a hot corner), and then coming out of screen saver (move off hot corner), the mac mini will sleep automatically - but only twice and *WITHIN* the time set in Energy Preferences - i.e. if energy preferences is set to sleep after 2 mins the mac mini will sleep in < 2 mins.  After waking up the mini will sleep one more time within 2 mins.  It wil lthen not sleep again until after reinvoking the screen saver.

While I managed to have this behaviour happen 2 or 3 times it isn't reproducable 100% of the time.

3. I have tried removing all the USB peripherals - keyboard and mouse, and I have also tried removing the screen (leaving only power and ethernet).

4.  Tried booting with the originally installed (non-server) version of the OS 10.5.7 - and it will also not sleep - which suggests its not something to do with the OS per-se perhaps - althought I had to boot from an external USB.

5. The following applescript will sleep the machine when run as an application:

on idle
   tell application "System Events" to sleep
end idle

If we can't figure out how to get the Energy Preferences sleep functionality to work then using an applescript could work - as long as inside the script I can figure out how to determine if apache or the FTP server is currently responding to a request.


Thoughts or ideas on what I should try next?
antonyuAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

strungCommented:
0
antonyuAuthor Commented:
I'd gone through almost all the suggestions in that article.

i.e. I reinstalled the OS from scratch to get rid of any non-apple stuff, I've turned off bluetooth, turned off all the services, I don't have any applications running, I didn't have any non-apple hardware attached, etc. etc.

I've now tried safebook and turning off spotlight indexing (as per this article: http://osxdaily.com/2007/03/22/how-to-completely-disable-spotlight/).

So far... machine still won't sleep.

Shouldn't a machine with only apple software installed, and with a straight out of the box OS image sleep?

Any other ideas?
0
junipllcCommented:
Ah, an Insomniac Mac. Warm milk and a relaxation CD should work.

The lack of sleeping despite OS version leads me to believe it might be hardware related. It's rare, but it does happen. I don't have a Mini, I have a MacBook Pro currently, but I did have a similar problem. Let's start with the software:

- When you mentioned that you "turned off Bluetooth" did you uncheck the checkbox in the Bluetooth Advanced settings dialog (attached)?
- If you disable your WOL, does that solve the problem? If so there might be a config in your WOL (and knockd if you have it installed already) that is conflicting. I know it's obvious, but I'd be remiss if I didn't start with the obvious :)

As far as the hardware is concerned, my experience tells me that the Bluetooth module itself can overheat in a MacBook Pro and cause this problem (that was my issue) -- I simply replaced it and it worked. However, if you don't need Bluetooth you can remove it. It's not for the faint-hearted...it could be considered MacSurgery. But here is a link to show you the location of the module:

http://www.methodshop.com/gadgets/tutorials/macmini-ram/

I'll see what else I can come up with, but that's a good start, I hope.
bluetooth.png
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

antonyuAuthor Commented:
On bluetooth: yes all the checkboxes were off in both bluetooth system preferences planes.

I've tried turning off WOL - no difference.

When I booted into OS 10.5.7 client version  the machine slept without issue (with bluetooth and WOL on) (although I had to turn off spotlight indexing "mdutil -a -i off" and  it took several minutes longer than Energy System Preferences setting).

I talked to Apple (I still have some of the 90 days free support available with OS X Server) and they claim OS X Server is designed so that it won't sleep / can't sleep on a MacMini - but I'm not sure I buy that - given Apple Menu -> Sleep works well.

Also yesterday I found one work around - an Donation Ware called Please Sleep from Dragon Systems.  This basically seems to do what the Energy Saver system preference setting is failing to do.  

However, it doesn't seem to take into account apache activity in determining idle (i.e. if the machine serves up a web page it doesn't reset the idle timer - but goes to sleep based on the last keyboard or mouse stroke).  I assume that the Energy Saver sleep function would take web or file server activity into account when determining when the machine was "idle"?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
junipllcCommented:
A server that can't sleep? Aren't we all supposed to be green these days??? ;)

You could probably hack up an AppleScript in there to monitor the weblogs, and if it sees activity to insert a mouse move event into the OS's queue...but I haven't played with AppleScript in years, so I wouldn't be able to tell you exactly how to do that. I wonder if there is a way to manipulate the events queue (mouse moves, clicks, even hitting the Control key) from the command line...that would just involve a "tail -f" on the weblogs.

Just an idea...if I find anything on the subject I'll post back. In the meantime that might be a solution you could try. At least that's where I'd start, especially since OS X is UNIX-based ... you can do just about anything!
0
junipllcCommented:
Why are you closing this without points? Did you try the solution I took the time to spec out for you? Namely, the tail -f and AppleScript?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Mac OS X

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.