4

I know I can do sleep $[60*60*8]; open alarm.mp3 but is there perhaps a better way?

Chealion
  • 25,408
  • 8
  • 67
  • 75
taw
  • 1,847
  • 4
  • 24
  • 28
  • Any specific reason it needs to be command line controllable? Or is a GUI app with AppleScript (`osascript`) good enough? – Chealion Aug 18 '10 at 05:38

1 Answers1

11

At least you can do

user@host:~$ at hh:mm
> /usr/bin/open alarm.mp3
>^D

which will make constantly opened terminal window unneeded.

ShreevatsaR
  • 866
  • 2
  • 9
  • 19
Catherine
  • 16,103
  • 5
  • 46
  • 55
  • This doesn't seem to actually work in Mac OS X. In fact, `at` doesn't seem to work at all. The command is added to `atq`, but never actually run. – ShreevatsaR Oct 30 '11 at 12:21
  • @ShreevatsaR, generally, it requires a working atd on *nix. I have never touched OS X myself, through. – Catherine Oct 30 '11 at 20:45
  • 1
    Ah ok, my previous comment was wrong... what it needs is the full path to `open`. Using `/usr/bin/open` works. (Actually since that starts iTunes by default, I used `/usr/bin/afplay` which ships with OS X.) – ShreevatsaR Oct 31 '11 at 01:17
  • @ShreevatsaR, `sox` is also quite good if you need a bit more than just playing. I guess it's available with Homebrew. – Catherine Oct 31 '11 at 05:51
  • Simple and efficient. Works on OS X, you have to start the atrun daemon though. See `man atrun`. – polym Jul 03 '15 at 15:27