I need a cron job script coded on MAC OS X following the process below:

  1. Put the computer into sleep mode on weekdays except Fridays at 10:30 pm.
  2. Wake the computer up from sleep, boost the volume to the max, and start playing a mp3 file located in /var/music/Kesha.mp3 at 7:00 am.
  3. Shutdown the computer after playing the track.

Anybody can make it? I need this very badly since I can't charge my phone any more.

One more thing, letting the computer to sleep overnights is a battery-consuming thing? Can you suggest this practice?

Thank you!

  • If you don't care if answers use cron or something else (Aurora is not the only alternative software solution), you should say so. Your other question also suffers from this. – Daniel Beck Nov 10 '10 at 14:28

You can use a combination of cron and iTunes Alarm (not tested).

  1. Make a cron job a root (sudo crontab -e)
    30 22 * * 1-4 /sbin/shutdown -s now

  2. Use iTunes Alarm to wake the computer from sleep and play the music. iTunes Alarm can also control the volume.

  3. Make another cron job that turns off the computer after some time (depending on the duration of the selected mp3)
    10 7 * * 1-4 /sbin/shutdown -h now

The last point could be improved. It is a compromise. The cron job that shuts down your computer is set to a specific time (07:10 am). Your selected mp3 is probably finished after 10 minutes.

| improve this answer | |
  • Your solution seems promising but how iTunes Alarm is supposed to wake the computer from sleep after shutting it down in the first step? Lastly, suppose that the track lasts for 4.15 mins, how can I reflect that in the last stage? – KGL Nov 10 '10 at 12:30
  • I found a GUI solution called Aurora from Metakine which even wakes a powered-off computer up. I am gonna give it a try. – KGL Nov 10 '10 at 13:11
  • the first step puts your computer into sleep: -s. -h means halt (poweroff). – kraftan Nov 10 '10 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.